Index: trunk/Ohana/src/dvopsps/include/dvopsps.h
===================================================================
--- trunk/Ohana/src/dvopsps/include/dvopsps.h	(revision 39111)
+++ trunk/Ohana/src/dvopsps/include/dvopsps.h	(revision 39112)
@@ -33,4 +33,5 @@
 
   unsigned int flags;
+  unsigned int objflags;
 } Detections;
 
Index: trunk/Ohana/src/dvopsps/src/insert_FGshape_dvopsps_catalog.c
===================================================================
--- trunk/Ohana/src/dvopsps/src/insert_FGshape_dvopsps_catalog.c	(revision 39111)
+++ trunk/Ohana/src/dvopsps/src/insert_FGshape_dvopsps_catalog.c	(revision 39112)
@@ -226,14 +226,18 @@
     PrintIOBuffer (gal_buffer, "%hd, ", galphot->modelType);          
 
-    PRINT_FLOAT(gal_buffer, galphot->mag,          "%.6e, ");
-    PRINT_FLOAT(gal_buffer, galphot->magErr,       "%.6e, ");
-    PRINT_FLOAT(gal_buffer, galphot->majorAxis,    "%.6e, ");
-    PRINT_FLOAT(gal_buffer, galphot->minorAxis,    "%.6e, ");
-    PRINT_FLOAT(gal_buffer, galphot->majorAxisErr, "%.6e, ");
-    PRINT_FLOAT(gal_buffer, galphot->minorAxisErr, "%.6e, ");
-    PRINT_FLOAT(gal_buffer, galphot->theta,        "%.6e, ");
-    PRINT_FLOAT(gal_buffer, galphot->thetaErr,     "%.6e, ");
-    PRINT_FLOAT(gal_buffer, galphot->index,        "%.6e, ");
-    PRINT_FLOAT(gal_buffer, galphot->chisq,        "%.6e, ");
+    float sersic_index = galphot->index;
+    if (galphot->modelType == 6) sersic_index = 1.0;
+    if (galphot->modelType == 7) sersic_index = 4.0;
+
+    PRINT_FLOAT(gal_buffer, galphot->mag,              "%.6e, ");
+    PRINT_FLOAT(gal_buffer, galphot->magErr,           "%.6e, ");
+    PRINT_FLOAT(gal_buffer, galphot->majorAxis,        "%.6e, ");
+    PRINT_FLOAT(gal_buffer, galphot->minorAxis,        "%.6e, ");
+    PRINT_FLOAT(gal_buffer, galphot->majorAxisErr,     "%.6e, ");
+    PRINT_FLOAT(gal_buffer, galphot->minorAxisErr,     "%.6e, ");
+    PRINT_FLOAT(gal_buffer, DEG_RAD*galphot->theta,    "%.6e, ");
+    PRINT_FLOAT(gal_buffer, DEG_RAD*galphot->thetaErr, "%.6e, ");
+    PRINT_FLOAT(gal_buffer, sersic_index,              "%.6e, ");
+    PRINT_FLOAT(gal_buffer, galphot->chisq,            "%.6e, ");
 
     PrintIOBuffer (gal_buffer, "%d ", (int) galphot->Npix); // NOTE: PRINT_FLOAT always adds a trailing comma -- need to use a different method on the last entry          
Index: trunk/Ohana/src/dvopsps/src/insert_detections_dvopsps_catalog.c
===================================================================
--- trunk/Ohana/src/dvopsps/src/insert_detections_dvopsps_catalog.c	(revision 39111)
+++ trunk/Ohana/src/dvopsps/src/insert_detections_dvopsps_catalog.c	(revision 39112)
@@ -184,5 +184,5 @@
   PrintIOBuffer (buffer, "INSERT INTO dvoDetectionFull (objID, detectID, ippObjID, ippDetectID, imageID, catID, ");
   PrintIOBuffer (buffer, "ra, dec_, raErr, decErr, zp, zpFactor, telluricExt, airmass, expTime, ");
-  PrintIOBuffer (buffer, "Mpsf, dMpsf, Mkron, dMkron, Map, dMap, flags) VALUES \n");
+  PrintIOBuffer (buffer, "Mpsf, dMpsf, Mkron, dMkron, Map, dMap, flags, objflags) VALUES \n");
 
   return TRUE;
@@ -234,4 +234,5 @@
 int insert_detections_mysql_detvalue (IOBuffer *buffer, Detections *detection) {
 
+# if (0) 
   if (detection->detectID == 164458937060000101) {
     fprintf (stderr, "isfinite: %d\n", isfinite(detection->dMpsf));
@@ -239,4 +240,5 @@
     fprintf (stderr, "isinf: %d\n", isinf(detection->dMpsf));
   }
+# endif
 
   // XXX I needed OFF_T_FMT on my 32bit ubuntu laptop; ok on 64bit?
@@ -265,5 +267,6 @@
   PRINT_FLOAT(buffer, detection->dMap,        "%.6f, ");
 
-  PrintIOBuffer (buffer, "%u),\n", detection->flags);	  // flags
+  PrintIOBuffer (buffer, "%u, ", detection->flags);	 // measure.flags
+  PrintIOBuffer (buffer, "%u),\n", detection->objflags); // average.flags
   return TRUE;
 }
@@ -341,7 +344,8 @@
   detection->dMap   = getdMagFromValueOrFlux (measure->FluxAp,   measure->dFluxAp,   measure->dMap);
 
-  detection->flags  = measure->dbFlags;  // flags
-
-  return TRUE;
-}
-
+  detection->flags     = measure->dbFlags; // flags
+  detection->objflags  = average->flags;   // flags
+
+  return TRUE;
+}
+
