Index: /branches/eam_branches/ipp-20140423/Ohana/src/dvomerge/src/dvo_image_merge_dbs.c
===================================================================
--- /branches/eam_branches/ipp-20140423/Ohana/src/dvomerge/src/dvo_image_merge_dbs.c	(revision 36812)
+++ /branches/eam_branches/ipp-20140423/Ohana/src/dvomerge/src/dvo_image_merge_dbs.c	(revision 36813)
@@ -168,4 +168,9 @@
 
   if (!IDmap->old) {
+    fprintf (stderr, "input database has image IDs, but no Image table\n");
+    return FALSE;
+  }
+
+  if (!IDmap->Nmap) {
     fprintf (stderr, "input database has image IDs, but no Image table\n");
     return FALSE;
Index: /branches/eam_branches/ipp-20140423/Ohana/src/dvomerge/src/dvomergeImageIDs.c
===================================================================
--- /branches/eam_branches/ipp-20140423/Ohana/src/dvomerge/src/dvomergeImageIDs.c	(revision 36812)
+++ /branches/eam_branches/ipp-20140423/Ohana/src/dvomerge/src/dvomergeImageIDs.c	(revision 36813)
@@ -18,4 +18,6 @@
   if (inDB.dbstate == LCK_EMPTY) {
     dvo_image_unlock (&inDB); // unlock input
+    IDmap->old = NULL;
+    IDmap->new = NULL;
     IDmap->Nmap = 0;
     return TRUE;
@@ -99,4 +101,6 @@
   if (inDB.dbstate == LCK_EMPTY) {
     dvo_image_unlock (&inDB); // unlock input
+    IDmap->old = NULL;
+    IDmap->new = NULL;
     IDmap->Nmap = 0;
     return TRUE;
Index: /branches/eam_branches/ipp-20140423/Ohana/src/relastro/include/relastro.h
===================================================================
--- /branches/eam_branches/ipp-20140423/Ohana/src/relastro/include/relastro.h	(revision 36812)
+++ /branches/eam_branches/ipp-20140423/Ohana/src/relastro/include/relastro.h	(revision 36813)
@@ -535,2 +535,5 @@
 
 int strextend (char *input, char *format,...);
+
+int areImagesLoaded ();
+int areImagesMatched ();
Index: /branches/eam_branches/ipp-20140423/Ohana/src/relastro/src/GetAstromError.c
===================================================================
--- /branches/eam_branches/ipp-20140423/Ohana/src/relastro/src/GetAstromError.c	(revision 36812)
+++ /branches/eam_branches/ipp-20140423/Ohana/src/relastro/src/GetAstromError.c	(revision 36813)
@@ -30,4 +30,5 @@
 
   code 	= GetPhotcodebyCode (measure[0].photcode);
+  if (!code) return NAN;
 
   // do not raise an exception, just send back the result
@@ -72,4 +73,5 @@
 
   code 	= GetPhotcodebyCode (measure[0].photcode);
+  if (!code) return NAN;
 
   // do not raise an exception, just send back the result
Index: /branches/eam_branches/ipp-20140423/Ohana/src/relastro/src/ImageOps.c
===================================================================
--- /branches/eam_branches/ipp-20140423/Ohana/src/relastro/src/ImageOps.c	(revision 36812)
+++ /branches/eam_branches/ipp-20140423/Ohana/src/relastro/src/ImageOps.c	(revision 36813)
@@ -39,4 +39,16 @@
 // N_onImage was 'Nlist'
 // N_ONIMAGE was 'NLIST'
+
+int areImagesLoaded () {
+
+  if (image) return TRUE;
+  return FALSE;
+}
+
+int areImagesMatched () {
+
+  if (MeasureToImage) return TRUE;
+  return FALSE;
+}
 
 Image *getimages (off_t *N, off_t **line_number) {
@@ -574,5 +586,5 @@
 
   int Noff = NoffRAave + NoffDECave + NoffRAori + NoffDECori;
-  if (VERBOSE && (Noff > 0)) fprintf (stderr, "Noff ave RA %d, Noff ave DEC %d, Noff ori RA %d, Noff ori DEC %d\n", NoffRAave, NoffDECave, NoffRAori, NoffDECori);
+  if (VERBOSE2 && (Noff > 0)) fprintf (stderr, "Noff ave RA %d, Noff ave DEC %d, Noff ori RA %d, Noff ori DEC %d\n", NoffRAave, NoffDECave, NoffRAori, NoffDECori);
   saveOffsets (dPos, nPos, im);
 
@@ -1095,4 +1107,5 @@
     } else {
       code = GetPhotcodebyCode (measure[0].photcode);
+      if (!code) return FALSE;
       mask = code[0].astromBadMask;
     }
@@ -1161,4 +1174,5 @@
     } else {
       code = GetPhotcodebyCode (measure[0].photcode);
+      if (!code) return FALSE;
       mask = code[0].astromBadMask;
     }
Index: /branches/eam_branches/ipp-20140423/Ohana/src/relastro/src/UpdateObjects.c
===================================================================
--- /branches/eam_branches/ipp-20140423/Ohana/src/relastro/src/UpdateObjects.c	(revision 36812)
+++ /branches/eam_branches/ipp-20140423/Ohana/src/relastro/src/UpdateObjects.c	(revision 36813)
@@ -80,4 +80,6 @@
   memset (&fitPAR, 0, sizeof(fitPAR));
   initObjectData (catalog, Ncatalog);
+
+  int setRefColor = areImagesMatched();
 
   /* project coordinates to a plane centered on the object with units of arcsec */
@@ -228,8 +230,10 @@
 	dD[N] = dY[N] / 3600.0;
 
-	float color = getColor (m+k, i);
-	if (!isnan(color)) {
-	  C[Nc] = color;
-	  Nc++;
+	if (setRefColor) {
+	  float color = getColor (m+k, i);
+	  if (!isnan(color)) {
+	    C[Nc] = color;
+	    Nc++;
+	  }
 	}
 
@@ -354,7 +358,9 @@
       }
 
-      dsort (C, Nc);
-      float colorMedian = (Nc > 0) ? C[(int)(0.5*Nc)] : NAN;
-      catalog[i].average[j].refColor = colorMedian;
+      if (setRefColor) {
+	dsort (C, Nc);
+	float colorMedian = (Nc > 0) ? C[(int)(0.5*Nc)] : NAN;
+	catalog[i].average[j].refColor = colorMedian;
+      }
 
       /* choose the result based on the chisq values */
Index: /branches/eam_branches/ipp-20140423/Ohana/src/relastro/src/relastro_objects.c
===================================================================
--- /branches/eam_branches/ipp-20140423/Ohana/src/relastro/src/relastro_objects.c	(revision 36812)
+++ /branches/eam_branches/ipp-20140423/Ohana/src/relastro/src/relastro_objects.c	(revision 36813)
@@ -40,4 +40,6 @@
     snprintf (hostfile, 1024, "%s/%s.cpt", hostpath, skylist[0].regions[i]->name);
     catalog.filename  = hostID ? hostfile : skylist[0].filename[i];
+
+    // set up the basic catalog info
     catalog.catformat = dvo_catalog_catformat (CATFORMAT);    // set the default catformat from config data
     catalog.catmode   = dvo_catalog_catmode (CATMODE);        // set the default catmode from config data
