             int threads = 512;
             int blocks = min((N + threads - 1) / threads, 1024);
 
-            scalarfield out_min(blocks);
-            scalarfield out_max(blocks);
-            scalarfield temp(1);
+            static scalarfield out_min(blocks);
+            static scalarfield out_max(blocks);
+            static scalarfield temp(1);
 
             cu_MinMax<<<blocks, threads>>>(&vf[0][0], out_min.data(), out_max.data(), N);
             cu_MinMax<<<1, 1024>>>(out_min.data(), out_min.data(), temp.data(), blocks);

            int threads = 512;
            int blocks = min((N + threads - 1) / threads, 1024);

            scalarfield ret(1, 0);
            cu_sum<<<blocks, threads>>>(sf.data(), ret.data(), N);
            cudaDeviceSynchronize();
            ret[0] = ret[0]/N;

            int threads = 512;
            int blocks = min((N + threads - 1) / threads, 1024);

            static vectorfield ret(1, {0,0,0});
            cu_sum<<<blocks, threads>>>(vf.data(), ret.data(), N);
            cudaDeviceSynchronize();
            return ret[0];
