Index: branches/eam_branches/ipp-20130509/Ohana/src/addstar/src/resort_catalog.c
===================================================================
--- branches/eam_branches/ipp-20130509/Ohana/src/addstar/src/resort_catalog.c	(revision 35741)
+++ branches/eam_branches/ipp-20130509/Ohana/src/addstar/src/resort_catalog.c	(revision 35743)
@@ -32,7 +32,7 @@
 void SortAveMeasMatch (off_t *MEAS, off_t *AVE, off_t N) {
 
-# define SWAPFUNC(A,B){ off_t tmp_meas; off_t tmp_ave;	\
-    tmp_meas = MEAS[A]; MEAS[A] = MEAS[B]; MEAS[B] = tmp_meas;		\
-    tmp_ave  = AVE[A];  AVE[A]  = AVE[B];  AVE[B]  = tmp_ave;		\
+# define SWAPFUNC(A,B){ off_t tmp_meas; off_t tmp_ave;		\
+    tmp_meas = MEAS[A]; MEAS[A] = MEAS[B]; MEAS[B] = tmp_meas;	\
+    tmp_ave  = AVE[A];  AVE[A]  = AVE[B];  AVE[B]  = tmp_ave;	\
   }
 # define COMPARE(A,B)(AVE[A] < AVE[B])
@@ -42,9 +42,9 @@
 }
 
-# define MARKTIME(MSG,...) { \
-  float dtime; \
-  gettimeofday (&stop, (void *) NULL); \
-  dtime = DTIME (stop, start); start = stop; \
-  fprintf (stderr, MSG, __VA_ARGS__); }
+# define MARKTIME(MSG,...) {			\
+    float dtime;				\
+    gettimeofday (&stop, (void *) NULL);	\
+    dtime = DTIME (stop, start); start = stop;	\
+    fprintf (stderr, MSG, __VA_ARGS__); }
 
 // XXX : where is the time going?  perhaps the ALLOCATE?
@@ -101,6 +101,6 @@
 	measure[measureSeq[i]].objID = average[averageSeq[i]].objID; // XXX I don't really like this...
       }
+# endif
     }
-# endif
   }
   
Index: branches/eam_branches/ipp-20130509/Ohana/src/delstar/src/Shutdown.c
===================================================================
--- branches/eam_branches/ipp-20130509/Ohana/src/delstar/src/Shutdown.c	(revision 35741)
+++ branches/eam_branches/ipp-20130509/Ohana/src/delstar/src/Shutdown.c	(revision 35743)
@@ -22,5 +22,5 @@
 
   SetProtect (TRUE);
-  gfits_db_close (db);
+  if (db) gfits_db_close (db);
   fprintf (stderr, "ERROR: delstar halted\n");
   exit (1);
Index: branches/eam_branches/ipp-20130509/Ohana/src/delstar/src/delete_fix_LAP_edges_delete.c
===================================================================
--- branches/eam_branches/ipp-20130509/Ohana/src/delstar/src/delete_fix_LAP_edges_delete.c	(revision 35741)
+++ branches/eam_branches/ipp-20130509/Ohana/src/delstar/src/delete_fix_LAP_edges_delete.c	(revision 35743)
@@ -83,4 +83,5 @@
 
     int myCatID = skylist[0].regions[i][0].index;
+    if (myCatID > maxCatID) continue;
     if (!catIDcount[myCatID]) continue;
 
@@ -106,7 +107,15 @@
     }
 
+    off_t NaverageStart = catalog.Naverage;
+    off_t NmeasureStart = catalog.Nmeasure;
     delete_fix_LAP_edges_drop_measures (&catalog, measure_edge, Nmeasure_edge, catIDcount[myCatID]);
 
-    // need to save the catalog here, after we confirm functionality
+    // skip if nothing was deleted
+    int noChange = (NaverageStart == catalog.Naverage) && (NmeasureStart == catalog.Nmeasure);
+    if (UPDATE && !noChange) {
+      // XXX save a backup copy first
+      dvo_catalog_backup (&catalog, TRUE);
+      dvo_catalog_save_complete (&catalog, VERBOSE2);
+    }
 
     dvo_catalog_unlock (&catalog);
@@ -135,4 +144,11 @@
     exit (1);
   }    
+
+  { 
+    // ensure that the paths are absolute path names
+    char *tmppath = abspath (EDGE_DELETIONS, DVO_MAX_PATH);
+    free (EDGE_DELETIONS);
+    EDGE_DELETIONS = tmppath;
+  }
 
   int i, j;
@@ -172,5 +188,5 @@
     if (VERBOSE2)   { snprintf (tmpline, 1024, "%s -vv",     command);             strcpy (command, tmpline); }
     if (SINGLE_CPT) { snprintf (tmpline, 1024, "%s -cpt %s", command, SINGLE_CPT); strcpy (command, tmpline); }
-    // if (UPDATE)     { snprintf (tmpline, 1024, "%s -update", command);             strcpy (command, tmpline); }
+    if (UPDATE)     { snprintf (tmpline, 1024, "%s -update", command);             strcpy (command, tmpline); }
 
     fprintf (stderr, "command: %s\n", command);
@@ -224,5 +240,5 @@
   for (i = 0; i < Nmeasure_edge; i++) {
     if (measure_edge[i].catID != myCatID) continue;
-    myAssert (NbadMeasures >= catIDcount, "too many bad measures?");
+    myAssert (NbadMeasures < catIDcount, "too many bad measures?");
     badMeasures[NbadMeasures] = i;
     NbadMeasures ++;
Index: branches/eam_branches/ipp-20130509/Ohana/src/delstar/src/delstar_client.c
===================================================================
--- branches/eam_branches/ipp-20130509/Ohana/src/delstar/src/delstar_client.c	(revision 35741)
+++ branches/eam_branches/ipp-20130509/Ohana/src/delstar/src/delstar_client.c	(revision 35743)
@@ -58,4 +58,13 @@
     }
 
+    case MODE_FIX_LAP_EDGES_DELETE: {
+      if (!delete_fix_LAP_edges_delete()) {
+	fprintf (stderr, "problem loading edge measures\n"); 
+	exit (1);
+      }
+      exit (0);
+      break;
+    }
+
     case MODE_IMAGEFILE:
       break;
Index: branches/eam_branches/ipp-20130509/Ohana/src/libdvo/include/dvo.h
===================================================================
--- branches/eam_branches/ipp-20130509/Ohana/src/libdvo/include/dvo.h	(revision 35741)
+++ branches/eam_branches/ipp-20130509/Ohana/src/libdvo/include/dvo.h	(revision 35743)
@@ -251,5 +251,5 @@
 /* definitions for parallel dvo host information 
    XXX : need better names (safer namespace)
- */
+*/
 
 typedef enum {
