Index: /branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/StarOps.c
===================================================================
--- /branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/StarOps.c	(revision 33548)
+++ /branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/StarOps.c	(revision 33549)
@@ -536,4 +536,8 @@
 	// set the output calibration
 	catalog[i].measure[m].Mcal = Mcal + Mmos + Mgrid;
+
+	if (catalog[i].measureT[m].dbFlags & ID_MEAS_PHOTOM_UBERCAL) {
+	  myAssert (isfinite(catalog[i].measure[m].Mcal), "oops, broke an ubercal mag");
+	}
       }
     }
Index: /branches/eam_branches/ipp-20111122/Ohana/src/uniphot/src/match_zpts_to_images.c
===================================================================
--- /branches/eam_branches/ipp-20111122/Ohana/src/uniphot/src/match_zpts_to_images.c	(revision 33548)
+++ /branches/eam_branches/ipp-20111122/Ohana/src/uniphot/src/match_zpts_to_images.c	(revision 33549)
@@ -44,4 +44,7 @@
       image[i].dMcal = NAN;
       image[i].flags &= ~ID_IMAGE_PHOTOM_NOCAL; // clear the NOCAL flag
+      if (UBERCAL) {
+	image[i].flags &= ~ID_IMAGE_PHOTOM_UBERCAL; // clear the UBERCAL flag
+      }
     }
   }
@@ -52,4 +55,9 @@
     // if (i % 1000 == 0) fprintf (stderr, ".");
     // if (Nz % 100 == 0) fprintf (stderr, "!");
+
+    if (!isfinite(zpts[Nz].zpt)) {
+      Nz++;
+      continue;
+    }
 
     Ni = index[i];
@@ -81,4 +89,5 @@
     if (UBERCAL) {
       image[Ni].Mcal = SCALE*code[0].C - zpts[Nz].zpt + 2.5*log10(image[Ni].exptime) + code[0].K*(image[Ni].secz - 1.000);
+      myAssert (isfinite(image[Ni].Mcal), "oops, ubercal made a nan image");
     } else {
       image[Ni].Mcal = SCALE*code[0].C - zpts[Nz].zpt;
Index: /branches/eam_branches/ipp-20111122/Ohana/src/uniphot/src/update_catalog_setphot.c
===================================================================
--- /branches/eam_branches/ipp-20111122/Ohana/src/uniphot/src/update_catalog_setphot.c	(revision 33548)
+++ /branches/eam_branches/ipp-20111122/Ohana/src/uniphot/src/update_catalog_setphot.c	(revision 33549)
@@ -26,4 +26,5 @@
       catalog[0].measure[m].Mcal = Mcal - Mcal_offset;
       catalog[0].measure[m].dMcal = dMcal;
+      myAssert(isfinite(catalog[0].measure[m].Mcal), "oops: ubercal made a nan");
 
       // if we are setting the zero points from an UBERCAL database, and this detection is from one of those images,
