Index: trunk/psphot/src/psphotChoosePSF.c
===================================================================
--- trunk/psphot/src/psphotChoosePSF.c	(revision 5058)
+++ trunk/psphot/src/psphotChoosePSF.c	(revision 5772)
@@ -13,5 +13,6 @@
     // array to store candidate PSF stars
     int NSTARS = psMetadataLookupS32 (&status, config, "PSF_MAX_NSTARS");
-    if (!status) NSTARS = sources->n;
+    if (!status) NSTARS = PS_MIN (sources->n, 200);
+
     stars = psArrayAlloc (sources->n);
     stars->n = 0;
@@ -20,8 +21,7 @@
     for (int i = 0; (i < sources->n) && (stars->n < NSTARS); i++) {
 	pmSource *source = sources->data[i];
-	if (source->type != PM_SOURCE_PSFSTAR) continue;
-	psArrayAdd (stars, 200, source);
+	if (source->mode & PM_SOURCE_PSFSTAR) psArrayAdd (stars, 200, source);
     }
-    psTrace (".psphot.pspsf", 3, "selected candidate %d PSF objects\n", stars->n);
+    psLogMsg ("psphot.pspsf", 3, "selected candidate %d PSF objects\n", stars->n);
 
     // get the fixed PSF fit radius
@@ -66,4 +66,6 @@
 	}
     }
+    // XXX EAM : need to unflag the PSF stars which are not used to build the PSF
+    // XXX EAM : each pmPSFtry needs to have its own mask array
 
     // keep only the selected model:
