         ix = thread_index % ifaces_x;
         iy = thread_index/ifaces_y;
 
-        I = (ix + mbc+1)*xs + (iy + mbc)*ys;
+        I = (iy + mbc + 1)*ys + (ix + mbc);
 
         //if (ix < mx && 0 < iy && iy < my+1)   /* Is this needed? */
         {

        ix = thread_index % ifaces_x;
        iy = thread_index/ifaces_y;

        I = (ix + mbc+1)*xs + (iy + mbc)*ys;

        //if (ix < mx && 0 < iy && iy < my+1)   /* Is this needed? */
        {

        ix = thread_index % ifaces_x;
        iy = thread_index/ifaces_y;

        I = (iy + mbc)*ys + (ix + mbc);

        //if (ix < mx && iy < my)   /* Is this needed? */
        {
