     const int v1 = BLOCK_SIZE * blockId + idy;
     const int v2 = BLOCK_SIZE * blockId + idx;
 
+    int newPred;
+    int newPath;
+
     const int cellId = v1 * pitch + v2;
-
     if (v1 < nvertex && v2 < nvertex) {
         cacheGraph[idy][idx] = graph[cellId];
         cachePred[idy][idx] = pred[cellId];
+        newPred = cachePred[idy][idx];
     } else {
         cacheGraph[idy][idx] = MAX_DISTANCE;
         cachePred[idy][idx] = -1;

    }
}


/**
 * Allocate memory on device and copy memory from host to device


    // Synchronize to make sure the all value are loaded in block
    __syncthreads();

    #pragma unroll
    for (int u = 0; u < BLOCK_SIZE; ++u) {
