Index: trunk/psphot/src/psphotSourceMatch.c
===================================================================
--- trunk/psphot/src/psphotSourceMatch.c	(revision 29548)
+++ trunk/psphot/src/psphotSourceMatch.c	(revision 29936)
@@ -6,15 +6,12 @@
 psArray *psphotMatchSources (pmConfig *config, const pmFPAview *view, const char *filerule) 
 {
-    bool status = true;
-
     psArray *objects = psArrayAllocEmpty(100);
 
-    int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM");
-    psAssert (status, "programming error: must define PSPHOT.INPUT.NUM");
+    int num = psphotFileruleCount(config, filerule);
 
     // loop over the available readouts
     for (int i = 0; i < num; i++) {
         if (!psphotMatchSourcesReadout (objects, config, view, filerule, i)) {
-            psError (PSPHOT_ERR_CONFIG, false, "failed to merge sources for PSPHOT.INPUT entry %d", i);
+	    psError (PSPHOT_ERR_CONFIG, false, "failed to merge sources for %s entry %d", filerule, i);
 	    psFree (objects);
             return NULL;
@@ -162,6 +159,5 @@
     psAssert (status, "missing SKY_OUTER_RADIUS in recipe?");
 
-    int nImages = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM");
-    psAssert (status, "programming error: must define PSPHOT.INPUT.NUM");
+    int nImages = psphotFileruleCount(config, filerule);
 
     // generate look-up arrays for detections and readouts
