Index: trunk/psModules/src/objects/pmFootprintAssignPeaks.c
===================================================================
--- trunk/psModules/src/objects/pmFootprintAssignPeaks.c	(revision 29004)
+++ trunk/psModules/src/objects/pmFootprintAssignPeaks.c	(revision 30621)
@@ -24,5 +24,5 @@
 /*
  * Given a psArray of pmFootprints and another of pmPeaks, assign the peaks to the
- * footprints in which that fall; if they _don't_ fall in a footprint, add a suitable
+ * footprints in which they fall; if they _don't_ fall in a footprint, add a suitable
  * one to the list.
  */
@@ -83,8 +83,18 @@
 
 	// XXX are we allowed to have peak-less footprints??
-	if (!fp->peaks->n) continue;
+	if (fp->peaks->n == 0) continue;
+	if (fp->peaks->n == 1) continue;
 
         fp->peaks = psArraySort(fp->peaks, pmPeakSortBySN);
 
+	// XXX check for an assert on duplicates (I don't think they can happen, but
+	// let's double check for now)
+
+	for (int j = 1; j < fp->peaks->n; j++) {
+	    psAssert (fp->peaks->data[j] != fp->peaks->data[j-1], "duplicate peak!");
+	}
+	continue;
+
+	// XXX WHY am I culling duplicates?  how can there be duplicates?
 	// XXX EAM : the algorithm below should be much faster than using psArrayRemove if
 	// the number of peaks in the footprint is large, or if there are no duplicates.
@@ -93,5 +103,5 @@
 
 	// track the number of good peaks in the footprint
-	int nGood = 1;
+	int lastGood = 0;
 
 	// check for duplicates
@@ -100,12 +110,13 @@
 	// (if sorted list has A, B, A, B ...)
 	for (int j = 1; j < fp->peaks->n; j++) { 
-	    if (fp->peaks->data[j] == fp->peaks->data[nGood]) {
+	    if (fp->peaks->data[j] == fp->peaks->data[lastGood]) {
 		// everything on the array has its own mem reference; free and drop this one
 		psFree (fp->peaks->data[j]);
 		fp->peaks->data[j] = NULL;
 	    } else {
-		nGood ++;
+		lastGood ++;
 	    }
 	}
+	int nGood = lastGood + 1;
 
 	// no deleted peaks, go to next footprint
