Index: /trunk/psastro/src/psastroConvert.c
===================================================================
--- /trunk/psastro/src/psastroConvert.c	(revision 15197)
+++ /trunk/psastro/src/psastroConvert.c	(revision 15198)
@@ -48,10 +48,11 @@
 
     // we are going to select the brighter Nmax subset for astrometry 
-    int nMax = psMetadataLookupS32 (&status, recipe, "PSASTRO.MAX.NSTAR");
-    if (!status || (nMax < 10)) nMax = 300; // 10 is really somewhat absurd as a lower limit
+    int nMax = psMetadataLookupS32 (&status, recipe, "PSASTRO.MAX.NRAW");
+    if (!status || !nMax) nMax = inStars->n; // 10 is really somewhat absurd as a lower limit
 
     // choose the first nMax sources
+    int j = 0;
     psArray *rawStars = psArrayAlloc (PS_MIN (nMax, inStars->n));
-    for (int i = 0, j = 0; (i < inStars->n) && (j < rawStars->n); i++) {
+    for (int i = 0; (i < inStars->n) && (j < rawStars->n); i++) {
 	int n = index->data.S32[i];
 	pmSource *source = sources->data[n];
@@ -60,4 +61,5 @@
 	j++;
     }
+    rawStars->n = j;
 
     psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSASTRO.RAWSTARS", PS_DATA_ARRAY, "astrometry objects", rawStars);
