 		offset >>= 1;
 		__syncthreads();
 
-		if (index < d) {
+		if (index < d && offset > 0) {
 			int ai = offset * (2 * index + 1) - 1;
 			int bi = offset * (2 * index + 2) - 1;
 			int t = temp[ai];


	int index = threadIdx.x;
	int offset = 1;

	// Copy input data to shared memory
	temp[2 * index] = src[2 * index + (blockIdx.x * blockDim.x * 2)];

		return;
	}

	if (index == 0) {
		dst[index] = 0;
	}
	else {
		dst[index] = src0[index * stride - 1] + src1[index * stride - 1];
	}
}

