Index: trunk/psLib/src/fits/psFitsScale.c
===================================================================
--- trunk/psLib/src/fits/psFitsScale.c	(revision 41504)
+++ trunk/psLib/src/fits/psFitsScale.c	(revision 41505)
@@ -987,4 +987,9 @@
     PS_ASSERT_FITS_NON_NULL(fits, NULL);
 
+    // fprintf (stderr, "psFitsScaleForDisk : bscale  : %g\n", bscale);
+    // fprintf (stderr, "psFitsScaleForDisk : bzero   : %g\n", bzero);
+    // fprintf (stderr, "psFitsScaleForDisk : boffset : %g\n", boffset);
+    // fprintf (stderr, "psFitsScaleForDisk : bsoften : %g\n", bsoften);
+
     psFitsOptions *options = fits->options; // FITS options
     if (!PS_IS_PSELEMTYPE_REAL(image->type.type) || !options || options->bitpix == 0) {
@@ -995,4 +1000,7 @@
     int bitpix = options->bitpix;       // Bits per pixel
     psElemType outType;                 // Type for output image
+
+    // fprintf (stderr, "psFitsScaleForDisk : bitpix : %d\n", bitpix);
+
     // Choosing to use signed types because those don't require BSCALE,BZERO to represent them in the FITS
     // file
@@ -1081,4 +1089,8 @@
 		    /* Check for underflow and overflow; set either to max */ \
 		    (OUT)->data.OUTTYPE[y][x] = (value < min || value > max ? max : floor(value)); \
+		    psAssert(x >= 0, "oops");				\
+		    psAssert(y >= 0, "oops");				\
+		    psAssert(x < numCols, "oops");			\
+		    psAssert(y < numRows, "oops");			\
 		}							\
             }								\
