Index: /trunk/Ohana/src/relphot/src/GridOps.c
===================================================================
--- /trunk/Ohana/src/relphot/src/GridOps.c	(revision 41663)
+++ /trunk/Ohana/src/relphot/src/GridOps.c	(revision 41664)
@@ -274,4 +274,6 @@
     if (!GridCorr[code]) continue;
 
+    // float GridSum = 0.0;
+    // int   GridCnt =   0;
     for (int ix = 0; ix < GridCorr[code]->Nx; ix++) {
       for (int iy = 0; iy < GridCorr[code]->Ny; iy++) {
@@ -292,6 +294,10 @@
 	GridCorr[code]->dMgrid[ix][iy] = sqrt(r*(Mgrid2 - Mgrid*Mgrid)); // sample stdev
 	// fprintf (stderr, "grid code %d, %d x %d : %f +/- %f : %d\n", code, ix, iy, GridCorr[code]-> Mgrid[ix][iy], GridCorr[code]->dMgrid[ix][iy], GridCorr[code]->nMgrid[ix][iy]);
+	// GridSum += Mgrid;
+	// GridCnt ++;
       }
     }
+    // float GridAve = GridSum / GridCnt;
+    // fprintf (stderr, "grid average: %f\n", GridAve);
   }
   return;
Index: /trunk/Ohana/src/relphot/src/ImageOps.c
===================================================================
--- /trunk/Ohana/src/relphot/src/ImageOps.c	(revision 41663)
+++ /trunk/Ohana/src/relphot/src/ImageOps.c	(revision 41664)
@@ -1021,4 +1021,5 @@
   free (mlist);
 
+  fprintf (stderr, "rationalize by image using %d pts\n", N);
   return stats.median; 
 }
@@ -1031,6 +1032,18 @@
     int mycode = GetPhotcodeEquivCodebyCode (image[i].photcode);
     if (mycode != photcode) continue;
-    image[i].McalPSF -= zpt;
-    image[i].McalAPER -= zpt;
+    // fprintf (stderr, "IMAGE %d zpt %f -> ", i, image[i].McalPSF);
+
+    int applyOffset = TRUE;
+    TGroup *mygrp = getTGroupForImage (i);
+    if (mygrp && (mygrp->flags & ID_IMAGE_TGROUP_PHOTCAL)) applyOffset = FALSE;
+
+    Mosaic *mymos = getMosaicForImage (i);
+    if (mymos && (mymos->flags & ID_IMAGE_MOSAIC_PHOTCAL)) applyOffset = FALSE;
+
+    if (applyOffset) {
+      image[i].McalPSF -= zpt;
+      image[i].McalAPER -= zpt;
+    }
+    // fprintf (stderr, "%f (%d)\n", image[i].McalPSF, applyOffset);
   }
 
Index: /trunk/Ohana/src/relphot/src/MosaicOps.c
===================================================================
--- /trunk/Ohana/src/relphot/src/MosaicOps.c	(revision 41663)
+++ /trunk/Ohana/src/relphot/src/MosaicOps.c	(revision 41664)
@@ -1574,4 +1574,16 @@
 }
 
+TGroup *getTGroupForMosaic (int mos) {
+  if (mos >= Nmosaic) return NULL;
+  if (mos < 0) return NULL;
+
+  if (!mosaic[mos].inTGroup) return NULL;
+
+  int imageIdx = MosaicToImage[mos][0];
+
+  TGroup *mygrp = getTGroupForImage (imageIdx);
+  return mygrp;
+}
+
 double get_median_zpt_mosaics (short photcode) {
 
@@ -1601,4 +1613,5 @@
   free (mlist);
 
+  fprintf (stderr, "rationalize by mosaic using %d pts\n", N);
   return stats.median; 
 }
@@ -1611,6 +1624,16 @@
   for (int i = 0; i < Nmosaic; i++) {
     if (mosaic[i].photcode != photcode) continue;
-    mosaic[i].McalPSF -= zpt;
-    mosaic[i].McalAPER -= zpt;
+    // fprintf (stderr, "MOSAIC %d zpt %f -> ", i, mosaic[i].McalPSF);
+
+    int applyOffset = TRUE;
+    TGroup *mygrp = getTGroupForMosaic (i);
+    if (mygrp && (mygrp->flags & ID_IMAGE_TGROUP_PHOTCAL)) applyOffset = FALSE;
+    if (!(mosaic[i].flags & ID_IMAGE_MOSAIC_PHOTCAL)) applyOffset = FALSE;
+
+    if (applyOffset) {
+      mosaic[i].McalPSF -= zpt;
+      mosaic[i].McalAPER -= zpt;
+    }
+    // fprintf (stderr, "%f (%d)\n", mosaic[i].McalPSF, applyOffset);
   }
 
Index: /trunk/Ohana/src/relphot/src/TGroupOps.c
===================================================================
--- /trunk/Ohana/src/relphot/src/TGroupOps.c	(revision 41663)
+++ /trunk/Ohana/src/relphot/src/TGroupOps.c	(revision 41664)
@@ -1335,5 +1335,5 @@
       }
       // too few exposures (configure)
-      if (tgroup[j].Nmosaic < 4) {
+      if ((tgroup[j].Nmosaic < 4) && (tgroup[j].Nimage < 4)) {
 	mark = TRUE;
 	NfewExp ++;
@@ -1395,4 +1395,5 @@
   free (mlist);
 
+  fprintf (stderr, "rationalize by tgroup using %d pts\n", N);
   return stats.median; 
 }
@@ -1407,4 +1408,5 @@
     for (int j = 0; j < tgroupTimes[i][0].nCode; j++) {
       if (tgroup[j].photcode != photcode) continue;
+      if (!(tgroup[j].flags & ID_IMAGE_TGROUP_PHOTCAL)) continue;
       tgroup[j].McalPSF -= zpt;
       tgroup[j].McalAPER -= zpt;
Index: /trunk/Ohana/src/relphot/src/relphot_images.c
===================================================================
--- /trunk/Ohana/src/relphot/src/relphot_images.c	(revision 41663)
+++ /trunk/Ohana/src/relphot/src/relphot_images.c	(revision 41664)
@@ -97,4 +97,6 @@
       SetZptIteration (i);
 
+      rationalize_zeropoints (i);
+
       setMrel  (catalog, Ncatalog); // threaded (calls setMrelCatalog)
 
@@ -102,6 +104,4 @@
       setMmos  (catalog);
       setMgrp  (catalog);
-
-      rationalize_zeropoints (i);
 
       setMgrid (catalog, Ncatalog);
