    if (ptNum != 0)
       cc[ptNum].z1 = x[spNum * rows + (ptNum - 1)];
 
-   cc[ptNum].p1 = pts[spNum * numPoints + ptNum];
-   cc[ptNum].p2 = pts[spNum * numPoints + (ptNum + 1)];
+   cc[ptNum].p1 = pts[spNum * (numPoints + 1) + ptNum];
+   cc[ptNum].p2 = pts[spNum * (numPoints + 1) + (ptNum + 1)];
 
    if (ptNum != rows)
       cc[ptNum].z2 = x[spNum * rows + ptNum];


   return ss_d;
}

__shared__ float h[TILE_SIZE];

__global__ void fillCubicCurves(CubicCurve* ccs, Point* pts, float* x) {
   // threadDim = numPoints
   int numPoints = blockDim.x;
   int numCurves = numPoints - 1;

   // j = spNum = spline number
   int spNum = blockIdx.x;
   // i = ptNum = point number
   int ptNum = threadIdx.x;

   int rows = numPoints - 2;

   // Now that we have the matrix, solve for x. X then holds our Z-values
   // (the second derivative at the points).

   cudaFree(A_d);
   cudaFree(b_d);

   fillCubicCurves<<<splines, num - 1>>>(ss_d, pts_d, x_d);

   /*
   for (j = 0; j < splines; j++) {
