 
     {
         PROFILE_CUDA_GROUP("Copy CPU buffer back to patches",5);
-        for (int i = 0; i < batch_size; ++i)    
+        for (i = 0; i < batch_size; ++i)    
         {      
-
-            cudaclaw_fluxes_t* fluxes = &(array_fluxes_struct[i]);
-            int I_q = i*fluxes->num;
+            fluxes = &(array_fluxes_struct[i]);
+            I_q = i*fluxes->num;
 
             memcpy(fluxes->qold,&membuffer_cpu[I_q],fluxes->num_bytes);
         }        

    maux = clawpatch_opt->maux;
    meqn = clawpatch_opt->meqn;  

    cudaclaw_fluxes_t* fluxes = &(array_fluxes_struct[0]);
    size = batch_size*(fluxes->num + fluxes->num_aux);
    bytes = size*sizeof(double);



    int mx,my,mbc,maux,meqn,mwaves;
    double maxcfl;

    double* maxcflblocks_dev;    

    double *membuffer_cpu, *membuffer_dev;
    cudaclaw_fluxes_t *array_fluxes_struct_dev;

    cudaclaw_fluxes_t* fluxes;

    /* To get patch-independent parameters */
    fc2d_cudaclaw_options_t *clawopt;
    fclaw2d_clawpatch_options_t *clawpatch_opt;

    /* ---------------------------------- start code ---------------------------------- */
    FCLAW_ASSERT(batch_size > 0);

    clawopt = fc2d_cudaclaw_get_options(glob);
    mwaves = clawopt->mwaves;
