Index: trunk/psphot/src/psphotChoosePSF.c
===================================================================
--- trunk/psphot/src/psphotChoosePSF.c	(revision 11702)
+++ trunk/psphot/src/psphotChoosePSF.c	(revision 12665)
@@ -74,7 +74,14 @@
 
     // select the candidate PSF stars (pointers to original sources)
-    for (int i = 0; (i < sources->n) && (stars->n < NSTARS); i++) {
+    for (int i = 0; i < sources->n; i++) {
         pmSource *source = sources->data[i];
-        if (source->mode & PM_SOURCE_MODE_PSFSTAR) psArrayAdd (stars, 200, source);
+        if (source->mode & PM_SOURCE_MODE_PSFSTAR) {
+	    // keep NSTARS PSF stars, unmark the rest
+	    if (stars->n < NSTARS) {
+		psArrayAdd (stars, 200, source);
+	    } else {
+		source->mode &= ~PM_SOURCE_MODE_PSFSTAR;
+	    }
+	} 
     }
     psLogMsg ("psphot.pspsf", PS_LOG_DETAIL, "selected candidate %ld PSF objects\n", stars->n);
