Index: /branches/eam_branches/ipp-20140904/Ohana/src/uniphot/src/load_zpt_table.c
===================================================================
--- /branches/eam_branches/ipp-20140904/Ohana/src/uniphot/src/load_zpt_table.c	(revision 37573)
+++ /branches/eam_branches/ipp-20140904/Ohana/src/uniphot/src/load_zpt_table.c	(revision 37574)
@@ -173,7 +173,8 @@
       mjdstart = tstart_uc[i];
       mjdstop  = tstop_uc[i];
-  } else {
+    } else {
       char name[9];
-      snprintf (name, 9, "TS0_%04d", i);
+      // snprintf (name, 9, "TS0_%04d", i);
+      snprintf (name, 9, "S0_MJD%d", i);
       if (!gfits_scan (&header, name, "%lf", 1, &mjdstart)) { 
 	fprintf (stderr, "cannot find %s in header of %s\n", name, filename);
@@ -182,5 +183,6 @@
       }
 
-      snprintf (name, 9, "TS1_%04d", i);
+      // snprintf (name, 9, "TS1_%04d", i);
+      snprintf (name, 9, "S1_MJD%d", i);
       if (!gfits_scan (&header, name, "%lf", 1, &mjdstop)) { 
 	fprintf (stderr, "cannot find %s in header of %s\n", name, filename);
@@ -189,6 +191,6 @@
       }
     }
-    flatcorrTable->tstart[i] = ohana_mjd_to_sec(mjdstart);
-    flatcorrTable->tstop[i]  = ohana_mjd_to_sec(mjdstop);
+    flatcorrTable->tstart[i] = (mjdstart > 0) ? ohana_mjd_to_sec(mjdstart) : ohana_mjd_to_sec(50000.0); // 1995/10/10 (ancient history)
+    flatcorrTable->tstop[i]  = (mjdstop  > 0) ? ohana_mjd_to_sec(mjdstop)  : ohana_mjd_to_sec(60000.0); // 2023/02/25 (infinite future)
   }
 
@@ -247,7 +249,8 @@
     } else {
       if (!gfits_scan (&header, "FILTER", "%s", 1, filter)) { 
-	fprintf (stderr, "cannot find FILTER in header of %s\n", filename);
-	fclose (f);
-	return NULL;
+	fprintf (stderr, "cannot find FILTER in header of %s, using %s\n", filename, filters_uc[nfilter]);
+	strcpy (filter, filters_uc[nfilter]);
+	// fclose (f);
+	// return NULL;
       }
     }
@@ -278,4 +281,19 @@
       REALLOCATE (offset64, double, matrix.Naxis[0]);
       matrix.buffer = (char *) offset64;
+    }
+    if (matrix.Naxes == 1) {
+      int Ntotal = NSEASON*NCHIP_X*NCHIP_Y*NCELL_X*NCELL_Y;
+      if (matrix.Naxis[0] != Ntotal) {
+	int Nextra = Ntotal - matrix.Naxis[0];
+	assert (Nextra >= 0);
+	fprintf (stderr, "warning: images are not fully populated, extending by %d\n", Nextra);
+	
+	REALLOCATE (offset64, double, Ntotal);
+	int npix;
+	for (npix = matrix.Naxis[0]; npix < Ntotal; npix ++) offset64[npix] = 0.0;
+
+	matrix.Naxis[0] = Ntotal;
+	matrix.buffer = (char *) offset64;
+      }
     }
 
