Index: trunk/Ohana/src/libdvo/src/dvo_catalog.c
===================================================================
--- trunk/Ohana/src/libdvo/src/dvo_catalog.c	(revision 8429)
+++ trunk/Ohana/src/libdvo/src/dvo_catalog.c	(revision 8456)
@@ -75,4 +75,5 @@
     catalog[0].catflags = 0;
     catalog[0].sorted = 0;
+    catalog[0].Nsecfilt = 0;
   }
 
@@ -88,5 +89,4 @@
   catalog[0].Nmeasure = 0;
   catalog[0].Nmissing = 0;
-  catalog[0].Nsecfilt = 0;
 
   catalog[0].Nave_disk  = 0;
@@ -173,7 +173,12 @@
   if (mode == DVO_OPEN_NONE) return (FALSE);
 
+  // save the expected Nsecfilt value for testing
+  Nsecfilt = catalog[0].Nsecfilt;
+
+  dvo_catalog_init (catalog, FALSE);
+
   catalog[0].lockmode  = LCK_XCLD;
   if (mode == DVO_OPEN_READ) catalog[0].lockmode  = LCK_SOFT;
-
+  
   // XXX make a backup?  always?
   if (!check_file_access (catalog[0].filename, TRUE, VERBOSE)) {
@@ -182,9 +187,6 @@
   }
 
-  if (VERBOSE) fprintf (stderr, "adding to %s\n", catalog[0].filename);
-    
-  // save the expected Nsecfilt value for testing
-  Nsecfilt = catalog[0].Nsecfilt;
-
+  if (VERBOSE) fprintf (stderr, "opening %s\n", catalog[0].filename);
+  
   switch (dvo_catalog_lock (catalog, catalog[0].lockmode)) {
   case 0:
@@ -203,5 +205,6 @@
     break;
   case 2:
-    if (DVO_OPEN_READ || DVO_OPEN_UPDATE) return (TRUE);
+    if ((mode == DVO_OPEN_READ) || (mode == DVO_OPEN_UPDATE)) return (TRUE);
+    catalog[0].Nsecfilt = Nsecfilt;
     dvo_catalog_create (region, catalog); /* fills in new header info */
     if (VERBOSE) fprintf (stderr, "creating new file %s\n", catalog[0].filename);
@@ -256,5 +259,4 @@
       if (VERBOSE) fprintf (stderr, "reading catalog (mode DVO_MODE_SPLIT)\n");
       dvo_catalog_load_split (catalog, VERBOSE);
-      dvo_catalog_test (catalog, TRUE);
       break;
     default:
@@ -326,4 +328,5 @@
   SecFilt *insec, *outsec;
 
+  if (Nsecfilt == 0) return (TRUE); // if Nsecfilt is not set, don't do this check
   if (catalog[0].Nsecfilt == Nsecfilt) return (TRUE);
   if (catalog[0].Nsecfilt > Nsecfilt) return (FALSE);
Index: trunk/Ohana/src/libdvo/src/dvo_catalog_raw.c
===================================================================
--- trunk/Ohana/src/libdvo/src/dvo_catalog_raw.c	(revision 8429)
+++ trunk/Ohana/src/libdvo/src/dvo_catalog_raw.c	(revision 8456)
@@ -35,4 +35,5 @@
     if (catalog[0].catformat != DVO_FORMAT_UNDEF) goto got_format;
   }
+  /* special cases: old versions of the DB tables which were poorly identified */
   if (gfits_scan (&catalog[0].header, "NEWMEAS",  "%t", 1, &NewMeasure)) {
     catalog[0].catformat = DVO_FORMAT_ELIXIR;
Index: trunk/Ohana/src/libdvo/src/dvo_catalog_split.c
===================================================================
--- trunk/Ohana/src/libdvo/src/dvo_catalog_split.c	(revision 8429)
+++ trunk/Ohana/src/libdvo/src/dvo_catalog_split.c	(revision 8456)
@@ -3,5 +3,5 @@
 int dvo_catalog_load_split (Catalog *catalog, int VERBOSE) {
 
-  int Nitems, Nexpect, Naverage, Nmeasure, Nmissing, Nsecfilt;
+  int Nitems, Nexpect, Naverage, Nmeasure, Nmissing, Nsecfilt, status;
   char *path, string[80];
   Header header;
@@ -60,5 +60,4 @@
     gfits_free_header (&header);
   } 
-  dvo_catalog_test (catalog, FALSE);
 
   /*** Measure Table ***/
@@ -111,5 +110,4 @@
     gfits_free_matrix (&matrix);
   }
-  dvo_catalog_test (catalog, FALSE);
 
   /* (Meta Load) */
@@ -143,5 +141,4 @@
   }
   catalog[0].measure_catalog = measure;
-  dvo_catalog_test (catalog, FALSE);
 
   /*** Missing Table ***/
@@ -158,7 +155,13 @@
 
     /* lock & open catalog file */
-    if (dvo_catalog_lock (missing, catalog[0].lockmode) != 1) {
-      fprintf (stderr, "cannot access missing file %s\n", missing[0].filename);
+    status = dvo_catalog_lock (missing, catalog[0].lockmode);
+    if (!status) {
+      fprintf (stderr, "ERROR: cannot access missing file %s\n", missing[0].filename);
       exit (2);
+    }
+    if (status == 2) {
+	/* MISSING table is empty (this is not an error) */
+	gfits_create_header (&missing[0].header);
+	goto missing_empty;
     }
 
@@ -191,6 +194,6 @@
     gfits_free_matrix (&matrix);
   } 
+missing_empty:
   catalog[0].missing_catalog = missing;
-  dvo_catalog_test (catalog, FALSE);
 
   /*** Secfilt Table ***/
@@ -241,5 +244,4 @@
   } 
   catalog[0].secfilt_catalog = secfilt;
-  dvo_catalog_test (catalog, FALSE);
 
   /* save the current number so we can do partial updates */
Index: trunk/Ohana/src/libdvo/src/dvo_convert.c
===================================================================
--- trunk/Ohana/src/libdvo/src/dvo_convert.c	(revision 8429)
+++ trunk/Ohana/src/libdvo/src/dvo_convert.c	(revision 8456)
@@ -428,4 +428,5 @@
       return (TRUE);
     case DVO_FORMAT_PANSTARRS:
+    case DVO_FORMAT_PMTEST:
       /* convert table rows from internal to external format */
       for (i = 0; i < Nrow; i++) {
