Index: trunk/ppStack/src/ppStackSources.c
===================================================================
--- trunk/ppStack/src/ppStackSources.c	(revision 31158)
+++ trunk/ppStack/src/ppStackSources.c	(revision 34174)
@@ -461,5 +461,17 @@
 
         // XXX something of a hack: require at least 2 detections or the nominated fraction of the max possible
-        int minMatches = PS_MAX(2, fracMatch * num);// Minimum number of matches required
+        //int minMatches = PS_MAX(2, fracMatch * num);// Minimum number of matches required
+        //MEH - if many poor images, will hit oddity with num fraction. use numGoodImages instead
+        int minMatches = PS_MAX(2, fracMatch * numGoodImages);// Minimum number of matches required
+
+	int good0 = 0;
+	for (int i = 0; i < num; i++) {
+	    if (inputMask->data.U8[i]) {
+		continue;
+	    }
+	    good0 = i;
+	    break;
+	}
+
         for (int i = 0; i < matches->n; i++) {
             pmSourceMatch *match = matches->data[i]; // Match of interest
@@ -469,6 +481,9 @@
 
             // We need to grab a single instance of this source: just take the first available
-            int image = match->image->data.S32[0]; // Index of image
-            int index = match->index->data.S32[0]; // Index of source within image
+	    // MEH - if first available is a rejected image, then problem. so take first non-rejected instance above
+            //int image = match->image->data.S32[0]; // Index of image
+            //int index = match->index->data.S32[0]; // Index of source within image
+            int image = match->image->data.S32[good0]; // Index of image
+            int index = match->index->data.S32[good0]; // Index of source within image
             psArray *sources = sourceLists->data[image]; // Sources for image
             pmSource *source = sources->data[index]; // Source of interest
