Index: branches/eam_branches/20091201/ppStack/src/ppStackConvolve.c
===================================================================
--- branches/eam_branches/20091201/ppStack/src/ppStackConvolve.c	(revision 26769)
+++ branches/eam_branches/20091201/ppStack/src/ppStackConvolve.c	(revision 26785)
@@ -94,4 +94,5 @@
         options->origCovars->data[i] = psMemIncrRefCounter(readout->covariance);
         if (!ppStackMatch(readout, options, i, config)) {
+	    // XXX many things can cause a failure of ppStackMatch -- should some be handled differently? 
             psErrorStackPrint(stderr, "Unable to match image %d --- ignoring.", i);
             options->inputMask->data.PS_TYPE_VECTOR_MASK_DATA[i] |= PPSTACK_MASK_MATCH;
Index: branches/eam_branches/20091201/ppStack/src/ppStackPhotometry.c
===================================================================
--- branches/eam_branches/20091201/ppStack/src/ppStackPhotometry.c	(revision 26769)
+++ branches/eam_branches/20091201/ppStack/src/ppStackPhotometry.c	(revision 26785)
@@ -90,9 +90,12 @@
     if (options->stats) {
         pmReadout *photRO = pmFPAviewThisReadout(photView, photFile->fpa); // Readout with the sources
-        psArray *sources = psMetadataLookupPtr(NULL, photRO->analysis, "PSPHOT.SOURCES"); // Sources
-        psMetadataAddS32(options->stats, PS_LIST_TAIL, "NUM_SOURCES", 0,
-                         "Number of sources detected", sources ? sources->n : 0);
-        psMetadataAddF32(options->stats, PS_LIST_TAIL, "TIME_PHOT", 0,
-                         "Time to do photometry", psTimerMark("PPSTACK_PHOT"));
+        pmDetections *detections = psMetadataLookupPtr(NULL, photRO->analysis, "PSPHOT.DETECTIONS"); // detections
+	if (detections) {
+	    psAssert (detections->allSources, "missing sources?");
+	    psMetadataAddS32(options->stats, PS_LIST_TAIL, "NUM_SOURCES", 0, "Number of sources detected", detections->allSources->n);
+	} else {
+	    psMetadataAddS32(options->stats, PS_LIST_TAIL, "NUM_SOURCES", 0, "Number of sources detected", 0);
+	}
+        psMetadataAddF32(options->stats, PS_LIST_TAIL, "TIME_PHOT", 0, "Time to do photometry", psTimerMark("PPSTACK_PHOT"));
     }
     psFree(photView);
Index: branches/eam_branches/20091201/ppStack/src/ppStackPrepare.c
===================================================================
--- branches/eam_branches/20091201/ppStack/src/ppStackPrepare.c	(revision 26769)
+++ branches/eam_branches/20091201/ppStack/src/ppStackPrepare.c	(revision 26785)
@@ -177,14 +177,16 @@
 
         bool redoPhot = psMetadataLookupBool(NULL, recipe, "PHOT");
-        psArray *sources = NULL;
-
+
+	pmDetections *detections = NULL;
         if (options->convolve || options->matchZPs || options->photometry || redoPhot) {
             pmReadout *ro = pmFPAviewThisReadout(view, inputFile->fpa); // Readout with sources
-            sources = psMetadataLookupPtr(NULL, ro->analysis, "PSPHOT.SOURCES"); // Sources
-            if (!sources) {
-                psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find sources in readout.");
+            detections = psMetadataLookupPtr(NULL, ro->analysis, "PSPHOT.DETECTIONS"); // Sources
+            if (!detections) {
+                psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find source detections in readout.");
                 return NULL;
             }
-            options->sourceLists->data[index] = psMemIncrRefCounter(sources);
+	    psAssert (detections->allSources, "missing sources?");
+	    
+            options->sourceLists->data[index] = psMemIncrRefCounter(detections->allSources);
         }
 
@@ -206,5 +208,5 @@
             pmReadout *ro = pmFPAviewThisReadout(view, file->fpa); // Readout of interest
 
-            if (!ppStackInputPhotometer(ro, sources, config)) {
+            if (!ppStackInputPhotometer(ro, detections->allSources, config)) {
                 psError(PS_ERR_UNKNOWN, false, "Unable to do photometry on input sources");
                 psFree(view);
