Index: trunk/ppStack/src/ppStackPhotometry.c
===================================================================
--- trunk/ppStack/src/ppStackPhotometry.c	(revision 26928)
+++ trunk/ppStack/src/ppStackPhotometry.c	(revision 27004)
@@ -61,5 +61,5 @@
     psArray *inSources = options->sources;
     if (!inSources) {
-        psError(PS_ERR_UNKNOWN, false, "Unable to find input sources");
+        psError(PPSTACK_ERR_PROG, false, "Unable to find input sources");
         psFree(photView);
         return false;
@@ -83,5 +83,5 @@
         !pmFPAfileDropInternal (config->files, "PSPHOT.BACKMDL.STDEV") ||
         !pmFPAfileDropInternal (config->files, "PSPHOT.BACKGND")) {
-        psError(PS_ERR_UNKNOWN, false, "Unable to drop PSPHOT internal files.");
+        psError(PPSTACK_ERR_PROG, false, "Unable to drop PSPHOT internal files.");
         return false;
     }
@@ -92,6 +92,5 @@
         pmReadout *photRO = pmFPAviewThisReadout(photView, photFile->fpa); // Readout with the sources
         pmDetections *detections = psMetadataLookupPtr(NULL, photRO->analysis, "PSPHOT.DETECTIONS"); // detections
-        if (detections) {
-            psAssert (detections->allSources, "missing sources?");
+        if (detections && detections->allSources) {
             psMetadataAddS32(options->stats, PS_LIST_TAIL, "NUM_SOURCES", 0, "Number of sources detected", detections->allSources->n);
         } else {
