Index: /tags/ipp-20110622/pswarp/src/pswarpMapGrid.c
===================================================================
--- /tags/ipp-20110622/pswarp/src/pswarpMapGrid.c	(revision 31878)
+++ /tags/ipp-20110622/pswarp/src/pswarpMapGrid.c	(revision 31879)
@@ -32,9 +32,7 @@
     int Ny = src->image->numRows + src->image->row0;
 
-    // allocate an extra superpixel to carry the remainder
-    int nXpts = Nx / nXpix;
-    int nYpts = Ny / nYpix;
-    if (Nx % nXpix) nXpts ++;
-    if (Ny % nYpix) nYpts ++;
+    // always allocate an extra superpixel to handle spillover
+    int nXpts = (int)(Nx / nXpix) + 1;
+    int nYpts = (int)(Ny / nYpix) + 1;
 
     // create the grid of maps
Index: /tags/ipp-20110622/pswarp/src/pswarpTransformReadout.c
===================================================================
--- /tags/ipp-20110622/pswarp/src/pswarpTransformReadout.c	(revision 31878)
+++ /tags/ipp-20110622/pswarp/src/pswarpTransformReadout.c	(revision 31879)
@@ -110,4 +110,9 @@
     // Ensure threading is off for the covariance calculation, since we are threading on a different level.
     psImageCovarianceSetThreads(false);
+
+    psAssert (xGridMin >= 0, "xGridMin too small\n");
+    psAssert (yGridMin >= 0, "yGridMin too small\n");
+    psAssert (xGridMax < grid->nXpts, "xGridMax too big\n");
+    psAssert (yGridMax < grid->nYpts, "yGridMax too big\n");
 
     // create jobs and supply them to the threads
