Index: /trunk/Ohana/src/dvopsps/src/insert_detections_dvopsps.c
===================================================================
--- /trunk/Ohana/src/dvopsps/src/insert_detections_dvopsps.c	(revision 37360)
+++ /trunk/Ohana/src/dvopsps/src/insert_detections_dvopsps.c	(revision 37361)
@@ -68,5 +68,5 @@
     catalog.Nsecfilt  = GetPhotcodeNsecfilt ();
 
-    if (!dvo_catalog_open (&catalog, skylist[0].regions[i], VERBOSE, "w")) {
+    if (!dvo_catalog_open (&catalog, skylist[0].regions[i], VERBOSE, "r")) {
       fprintf (stderr, "ERROR: failure reading catalog %s\n", catalog.filename);
       exit (1);
@@ -95,4 +95,9 @@
     dvo_catalog_unlock (&catalog);
     dvo_catalog_free (&catalog);
+
+    if (!status) {
+      fprintf (stderr, "failure to insert data in mysql\n");
+      exit (2);
+    }
   }
 
Index: /trunk/Ohana/src/dvopsps/src/insert_detections_dvopsps_catalog.c
===================================================================
--- /trunk/Ohana/src/dvopsps/src/insert_detections_dvopsps_catalog.c	(revision 37360)
+++ /trunk/Ohana/src/dvopsps/src/insert_detections_dvopsps_catalog.c	(revision 37361)
@@ -210,5 +210,4 @@
   // XXX check return status
   if (mysql) {
-    if (DEBUG) fprintf (stderr, "%s\n", buffer->buffer);
     int mysqlStatus = mysql_query(mysql, buffer->buffer); 
     if (mysqlStatus) {
@@ -216,4 +215,5 @@
       fprintf (stderr, "%s\n", mysql_error(mysql));
       fprintf (stderr, "Nbuffer: %d\n", buffer->Nbuffer);
+      if (DEBUG) fprintf (stderr, "%s\n", buffer->buffer);
       status = FALSE;
     }
@@ -232,4 +232,10 @@
 
 int insert_detections_mysql_detvalue (IOBuffer *buffer, Detections *detection) {
+
+  if (detection->detectID == 164458937060000101) {
+    fprintf (stderr, "isfinite: %d\n", isfinite(detection->dMpsf));
+    fprintf (stderr, "isnan: %d\n", isnan(detection->dMpsf));
+    fprintf (stderr, "isinf: %d\n", isinf(detection->dMpsf));
+  }
 
   PrintIOBuffer (buffer, "(%lu, ", detection->objID);	    // objID
@@ -268,5 +274,5 @@
 
   if (isfinite(flux) && (flux > 0.0)) {
-    fprintf (stderr, "how did we get here?\n");
+    // fprintf (stderr, "funny flux: %f with mag %f\n", flux, mag);
     return (zp - 2.5*log10(flux));
   }
Index: /trunk/Ohana/src/dvopsps/src/insert_objects_dvopsps.c
===================================================================
--- /trunk/Ohana/src/dvopsps/src/insert_objects_dvopsps.c	(revision 37360)
+++ /trunk/Ohana/src/dvopsps/src/insert_objects_dvopsps.c	(revision 37361)
@@ -56,5 +56,5 @@
     catalog.Nsecfilt  = GetPhotcodeNsecfilt ();
 
-    if (!dvo_catalog_open (&catalog, skylist[0].regions[i], VERBOSE, "w")) {
+    if (!dvo_catalog_open (&catalog, skylist[0].regions[i], VERBOSE, "r")) {
       fprintf (stderr, "ERROR: failure reading catalog %s\n", catalog.filename);
       exit (1);
