Index: /branches/eam_branches/ipp-20140610/psLib/src/imageops/psImageBackground.c
===================================================================
--- /branches/eam_branches/ipp-20140610/psLib/src/imageops/psImageBackground.c	(revision 37021)
+++ /branches/eam_branches/ipp-20140610/psLib/src/imageops/psImageBackground.c	(revision 37022)
@@ -124,5 +124,5 @@
         }
     } else if (nSubset >= nGoodPixels) {
-	    psTrace ("psLib.imageops", 4, "case 2: nSubset >= nGoodPixels (%d x %d : %d : %d : %d)\n", (int) nx, (int) ny, (int) nSubset, (int) nGoodPixels, (int) nPixels);
+	psTrace ("psLib.imageops", 4, "case 2: nSubset >= nGoodPixels (%d x %d : %d : %d : %d)\n", (int) nx, (int) ny, (int) nSubset, (int) nGoodPixels, (int) nPixels);
 	// in this case, we have to select from all masked pixels just to get the desired
 	// sample size
@@ -157,5 +157,9 @@
 	    double frnd = psRandomUniform(rng);
 	    int pixel = pixelVector->n * frnd;
-		
+	    // psAssert (pixel < pixelVector->nalloc, "oops, we went too far (1)");
+	    // psAssert (pixel >= 0, "oops, we went too far (2)");
+	    // psAssert (pixelVector->n - 1 < pixelVector->nalloc, "oops, we went too far (3)");
+	    // psAssert (pixelVector->n - 1 >= 0, "oops, we went too far (4)");
+
 	    psVectorAppend(values, pixelVector->data.F32[pixel]);
 	    pixelVector->data.F32[pixel] = pixelVector->data.F32[pixelVector->n - 1];
