Index: /branches/eam_branches/ohana.20170822/src/relphot/src/ImageOps.c
===================================================================
--- /branches/eam_branches/ohana.20170822/src/relphot/src/ImageOps.c	(revision 40288)
+++ /branches/eam_branches/ohana.20170822/src/relphot/src/ImageOps.c	(revision 40289)
@@ -643,6 +643,7 @@
     int minUbercalDist = 1000;
     
-    off_t Nref = 0;  // total number of reference stars on the image
-    int Nbright = 0; // number of stars to measure the bright-end scatter
+    off_t Nref = 0;    // number of stars used to measure McalPSF
+    int   Nkron = 0;   // number of stars to measure McalAPER
+    int   Nbright = 0; // number of stars to measure the bright-end scatter
 
     if (N_onImage[i] == 0) {
@@ -682,5 +683,4 @@
 	  continue;
       }
-      float MrelKron  = getMrel  (catalog, m, c, MAG_CLASS_KRON, MAG_SRC_CHP);
       
       // image.Mcal is not supposed to include the flat-field correction, so we need to
@@ -697,5 +697,4 @@
 	continue;
       }
-      float MsysKron = PhotSysTiny (&catalog[c].measureT[m], &catalog[c].averageT[n], &catalog[c].secfilt[n*Nsecfilt], MAG_CLASS_KRON);
 
       PhotCode *code = GetPhotcodebyCode (catalog[c].measureT[m].photcode);
@@ -715,8 +714,14 @@
       }
 
-      kronStars->flxlist[Nref] = MsysKron - MrelKron - Mmos - Mgrid + Mflat;
-      kronStars->errlist[Nref] = MAX (catalog[c].measureT[m].dM, MIN_ERROR);
-      kronStars->wgtlist[Nref] = 1;
-      kronStars->msklist[Nref] = 0;
+      float MrelKron = getMrel  (catalog, m, c, MAG_CLASS_KRON, MAG_SRC_CHP);
+      float MsysKron = PhotSysTiny (&catalog[c].measureT[m], &catalog[c].averageT[n], &catalog[c].secfilt[n*Nsecfilt], MAG_CLASS_KRON);
+
+      if (isfinite(MrelKron) && isfinite(MsysKron)) {
+	kronStars->flxlist[Nkron] = MsysKron - MrelKron - Mmos - Mgrid + Mflat;
+	kronStars->errlist[Nkron] = MAX (catalog[c].measureT[m].dM, MIN_ERROR);
+	kronStars->wgtlist[Nkron] = 1;
+	kronStars->msklist[Nkron] = 0;
+	Nkron ++;
+      }
 
       if ((image[i].imageID == TEST_IMAGE1) || (image[i].imageID == TEST_IMAGE2)) {
@@ -763,5 +768,5 @@
     // no additional weight modification (we treat all stars on an image equally -- note an image is either ubercal-tied or not)
 # if (BASIC_STATS) 
-    liststats (kronStars->flxlist, kronStars->errlist, NULL, Nref, &stats);
+    liststats (kronStars->flxlist, kronStars->errlist, NULL, Nkron, &stats);
 # else
     liststats_irls (kronStars, Nref, &stats);
