   return err;
 }
 
-__forceinline__ __device__ void __kupdateTile(float grad, int i, int ihere, int jhere, float *MM, float *Mask, int maskrows, float *lrate, int lrlen, float limit, int x) {
+__forceinline__ __device__ void __kupdateTile(float grad, int i, int ihere, int jhere, float *MM, float *Mask, int maskrows, float *lrate, int lrlen, float limit, int y) {
   float lr, ngrad;
-  lr =  (lrlen > 1) ? lrate[i+x] : lrate[0];
+  lr =  (lrlen > 1) ? lrate[i+y] : lrate[0];
   ngrad = grad * lr;
   if (limit > 0) ngrad = max(-limit, min(limit, ngrad));
   atomicAdd(&MM[ihere], ngrad);

        jhere = Bir[j] - x;
        if (jhere >= 0 && jhere < ncols) {
          ihere = i + nrows * jhere;
          __kupdateTile(grad, i, ihere, jhere, MM, Mask, maskrows, lrate, lrlen, limit, x);
        }
      }
    } 

          grad = aval;
          ihere = i + nrows * nbr;
          jhere = nbr;
          __kupdateTile(grad, i, ihere, jhere, MM, Mask, maskrows, lrate, lrlen, limit, y);
        }
        grad = aval * Bdata[j];
        jhere = Bir[j] - x;
        if (jhere >= 0 && jhere < ncols) {
          ihere = i + nrows * jhere;
          __kupdateTile(grad, i, ihere, jhere, MM, Mask, maskrows, lrate, lrlen, limit, y);
        }
      }
    } 
