Index: /tags/ipp-20120216/psModules/src/objects/pmPCMdata.c
===================================================================
--- /tags/ipp-20120216/psModules/src/objects/pmPCMdata.c	(revision 33444)
+++ /tags/ipp-20120216/psModules/src/objects/pmPCMdata.c	(revision 33445)
@@ -136,4 +136,18 @@
 	    sum += value;
 	}
+    }
+
+    if (!(sum > 0.0)) {
+        // Crazy PSF image print out some debugging information ...
+        fprintf(stderr, "invalid kernel sum %f found by pmPCMkernelFromPSF\n", sum);    for (int j = psf->yMin; j <= psf->yMax; j++) {
+            fprintf(stderr, "Row %d\n", j);
+            for (int i = psf->xMin; i <= psf->xMax; i++) {
+                double value = source->psfImage->data.F32[y0 + j][x0 + i];
+                fprintf(stderr, "  %d %f\n", i, value);
+            }
+        }
+        fflush(stderr);
+        // ... but avoid the asssertion two lines down by escaping
+        goto escape;
     }
     assert (sum > 0.0);
Index: /tags/ipp-20120216/psModules/src/objects/pmSourceIO.c
===================================================================
--- /tags/ipp-20120216/psModules/src/objects/pmSourceIO.c	(revision 33444)
+++ /tags/ipp-20120216/psModules/src/objects/pmSourceIO.c	(revision 33445)
@@ -1069,4 +1069,9 @@
                 for (long i = sources->n -1; i >= 0; i--) {
                     pmSource *source = sources->data[i];
+                    if (source->seq < 0) {
+                        // This can happen cmf files that have been corrupted
+                        psError(PS_ERR_IO, true, "seq < 0 for source %ld in %s", i, file->origname);
+                        return false;
+                    }
                     if (source->seq > seq_max) {
                         seq_max = source->seq;
Index: /tags/ipp-20120216/psphot/src/psphotMergeSources.c
===================================================================
--- /tags/ipp-20120216/psphot/src/psphotMergeSources.c	(revision 33444)
+++ /tags/ipp-20120216/psphot/src/psphotMergeSources.c	(revision 33445)
@@ -677,5 +677,8 @@
       if (sourceOut->modelPSF) {
 	pmSourceRedefinePixels (sourceOut, readoutOut, sourceOut->peak->x, sourceOut->peak->y, sourceOut->modelPSF->fitRadius);
-      }
+      } else {
+        // if we have no pixels we can't use it to determine the psf so make sure this bit is off
+        sourceOut->tmpFlags &= ~PM_SOURCE_TMPF_CANDIDATE_PSFSTAR;
+       }
 
       // child sources have not been subtracted in this image, but this flag may be raised if
@@ -900,6 +903,10 @@
 	    // allocate image, weight, mask for the new image for each peak
 	    if (sourceOut->modelPSF) {
-	      pmSourceRedefinePixels (sourceOut, readout, sourceOut->peak->x, sourceOut->peak->y, sourceOut->modelPSF->fitRadius);
-	    }
+                pmSourceRedefinePixels (sourceOut, readout, sourceOut->peak->x, sourceOut->peak->y, 
+                                                                        sourceOut->modelPSF->fitRadius);
+	    } else {
+                // if we have no pixels we can't use it to determine the psf so make sure this bit is off
+                sourceOut->tmpFlags &= ~PM_SOURCE_TMPF_CANDIDATE_PSFSTAR;
+            }
 
 	    // child sources have not been subtracted in this image, but this flag may be raised if
