smem: try not to re-create the variables too many times.