Index: trunk/psphot/src/psphotFindFootprints.c
===================================================================
--- trunk/psphot/src/psphotFindFootprints.c	(revision 25755)
+++ trunk/psphot/src/psphotFindFootprints.c	(revision 26894)
@@ -41,7 +41,5 @@
     if (pass == 2) {
         // merge in old peaks;
-        const int includePeaks = 0x0 | 0x2; // i.e. just from newFootprints
-
-        // XXX EAM : still not sure I understand this: are we double-couning or undercounting peaks
+        const int includePeaks = 0x1 | 0x2; // i.e. both new and old footprints
 
         psArray *mergedFootprints = pmFootprintArraysMerge(detections->footprints, footprints, includePeaks);
@@ -50,4 +48,6 @@
         psFree(footprints);
         psFree(detections->footprints);
+
+	// replace the merged footprints on the detection structure
         detections->footprints = mergedFootprints;
     } else {
@@ -61,2 +61,17 @@
     return detections;
 }
+
+bool psphotCheckFootprints (pmDetections *detections) {
+
+    // check for messed up footprints in the old peaks
+    for (int i = 0; i < detections->oldPeaks->n; i++) {
+	pmPeak *peak = detections->oldPeaks->data[i];
+	pmFootprint *footprint = peak->footprint;
+	if (!footprint) continue;
+	for (int j = 0; j < footprint->spans->n; j++) {
+	    pmSpan *sp = footprint->spans->data[j];
+	    psAssert (sp, "missing span");
+	}
+    }
+    return true;
+}
