Index: /branches/eam_branches/ipp-20130509/Ohana/src/relphot/src/ImageOps.c
===================================================================
--- /branches/eam_branches/ipp-20130509/Ohana/src/relphot/src/ImageOps.c	(revision 35599)
+++ /branches/eam_branches/ipp-20130509/Ohana/src/relphot/src/ImageOps.c	(revision 35600)
@@ -691,4 +691,9 @@
   if (!PLOTSTUFF) return;
 
+  if (Npts == 0) {
+    fprintf (stderr, "cannot set image Mcal values yet (nan Mave)\n");
+    return;
+  }
+
   ALLOCATE (xlist, double, Npts);
 
Index: /branches/eam_branches/ipp-20130509/Ohana/src/relphot/src/load_images.c
===================================================================
--- /branches/eam_branches/ipp-20130509/Ohana/src/relphot/src/load_images.c	(revision 35599)
+++ /branches/eam_branches/ipp-20130509/Ohana/src/relphot/src/load_images.c	(revision 35600)
@@ -95,4 +95,9 @@
 # endif
 
+  if (Nimage == 0) {
+    fprintf (stderr, "no images selected for analysis : problem with region or photcode?\n");
+    exit (4);
+  }
+
   // match chips to mosaics (if applicable)
   initMosaics (subset, Nsubset, image, inSubset, Nimage);
Index: /branches/eam_branches/ipp-20130509/Ohana/src/relphot/src/plot_scatter.c
===================================================================
--- /branches/eam_branches/ipp-20130509/Ohana/src/relphot/src/plot_scatter.c	(revision 35599)
+++ /branches/eam_branches/ipp-20130509/Ohana/src/relphot/src/plot_scatter.c	(revision 35600)
@@ -48,4 +48,6 @@
 
 		Mrel = catalog[i].secfilt[Nsecfilt*j+Nsec].M;
+		if (isnan(Mrel)) continue;
+
 		xlist[N] = Mrel;
 		ylist[N] = PhotSysTiny (&catalog[i].measureT[m], &catalog[i].averageT[j], &catalog[i].secfilt[j*Nsecfilt]) - Mcal - Mmos - Mgrid - Mrel;
@@ -54,4 +56,9 @@
 	    }
 	}
+    }
+
+    if (N == 0) {
+      fprintf (stderr, "no valid average values yet\n");
+      continue;
     }
 
Index: /branches/eam_branches/ipp-20130509/Ohana/src/relphot/src/plotstuff.c
===================================================================
--- /branches/eam_branches/ipp-20130509/Ohana/src/relphot/src/plotstuff.c	(revision 35599)
+++ /branches/eam_branches/ipp-20130509/Ohana/src/relphot/src/plotstuff.c	(revision 35600)
@@ -23,5 +23,5 @@
   char name[100];
 
-  sprintf (name, "gastro [%d]", N);
+  sprintf (name, "gastro:%d", N);
 
   // if -plot is supplied, the plots are shown on the screen; 
Index: /branches/eam_branches/ipp-20130509/Ohana/src/relphot/src/select_images.c
===================================================================
--- /branches/eam_branches/ipp-20130509/Ohana/src/relphot/src/select_images.c	(revision 35599)
+++ /branches/eam_branches/ipp-20130509/Ohana/src/relphot/src/select_images.c	(revision 35600)
@@ -407,4 +407,7 @@
   tcoords.pc1_1  = tcoords.pc2_2 = 1.0;
   tcoords.pc1_2  = tcoords.pc2_1 = 0.0;
+
+  tcoords.Npolyterms = 0;
+  memset (tcoords.polyterms, 0, 14*sizeof(float));
   strcpy (tcoords.ctype, "RA---TAN");
 
