         sum1[tx] = 0.0;
         sum2[tx] = 0.0;
     }
-        
-    __syncthreads();
-    
+
+    __syncthreads();
+
     for (unsigned int s = SUM_SITES_BLOCK_SIZE / 2; s > 0; s >>= 1) {
         if (tx < s) {
             sum1[tx] += sum1[tx + s];

        }
        __syncthreads();
    }
    
    if (tx == 0) {
        dSum1[blockIdx.x] = sum1[0];
        dSum2[blockIdx.x] = sum2[0];


    int tx = threadIdx.x;
    int pattern = threadIdx.x + blockIdx.x * SUM_SITES_BLOCK_SIZE;

    if (pattern < patternCount) {
        REAL pWeight = dPatternWeights[pattern];
        sum1[tx] = dArray1[pattern] * pWeight;
