             dsm_dmp.getBuffer(), dsm_dmp.getPitch(),
             timg_dmp.getBuffer(), timg_dmp.getPitch(),
             width, height, id);
-        cudaThreadSynchronize();
 
         cudaUnbindTexture(tTexU4);
         copy((tTexU4_arr), timg_dmp);
         cudaBindTextureToArray(tTexU4, tTexU4_arr.getArray(), cudaCreateChannelDesc<uchar4>());
-        cudaThreadSynchronize();
 
         refine_compYKNCCSim_kernel<<<grid, block>>>(
             ssm_dmp.getBuffer(), ssm_dmp.getPitch(),

            d_volSimT.getBytesPaddedUpToDim(1),
            d_volSimT.getBytesPaddedUpToDim(0),
            volDimX, volDimY, volDimZ, z);
        cudaThreadSynchronize();
        CHECK_CUDA_ERROR();

        volume_agregateCostVolumeAtZinSlices_kernel<<<gridvolrowAllCols, blockvolrow>>>(

            rcDepthMap_dmp.getBuffer(), rcDepthMap_dmp.getPitch(),
            width, height, wsh, gammaC, gammaP, epipShift,
            (float)(i - (ntcsteps - 1) / 2), i, moveByTcOrRc, xFrom, imWidth, imHeight);
    };

    refine_setLastThreeSimsMap_kernel<<<grid, block>>>(
