Index: /branches/eam_branch_20071130/Ohana/src/addstar/src/UpdateDatabase_Image.c
===================================================================
--- /branches/eam_branch_20071130/Ohana/src/addstar/src/UpdateDatabase_Image.c	(revision 15740)
+++ /branches/eam_branch_20071130/Ohana/src/addstar/src/UpdateDatabase_Image.c	(revision 15741)
@@ -74,4 +74,5 @@
       SetProtect (TRUE);
       if (options[0].update) {
+	catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF;
 	dvo_catalog_update (&catalog, VERBOSE);
       } else {
Index: /branches/eam_branch_20071130/Ohana/src/addstar/src/UpdateDatabase_Refcat.c
===================================================================
--- /branches/eam_branch_20071130/Ohana/src/addstar/src/UpdateDatabase_Refcat.c	(revision 15740)
+++ /branches/eam_branch_20071130/Ohana/src/addstar/src/UpdateDatabase_Refcat.c	(revision 15741)
@@ -63,4 +63,5 @@
       SetProtect (TRUE);
       if (options[0].update) {
+	catalog.catflags  = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF;
 	dvo_catalog_update (&catalog, VERBOSE);
       } else {
Index: /branches/eam_branch_20071130/Ohana/src/addstar/src/UpdateDatabase_Reflist.c
===================================================================
--- /branches/eam_branch_20071130/Ohana/src/addstar/src/UpdateDatabase_Reflist.c	(revision 15740)
+++ /branches/eam_branch_20071130/Ohana/src/addstar/src/UpdateDatabase_Reflist.c	(revision 15741)
@@ -59,4 +59,5 @@
       SetProtect (TRUE);
       if (options[0].update) {
+	catalog.catflags  = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF;
 	dvo_catalog_update (&catalog, VERBOSE);
       } else {
Index: /branches/eam_branch_20071130/Ohana/src/addstar/src/addstar.c
===================================================================
--- /branches/eam_branch_20071130/Ohana/src/addstar/src/addstar.c	(revision 15740)
+++ /branches/eam_branch_20071130/Ohana/src/addstar/src/addstar.c	(revision 15741)
@@ -143,4 +143,5 @@
       SetProtect (TRUE);
       if (options.update) {
+	catalog.catflags  = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF;
 	dvo_catalog_update (&catalog, VERBOSE);
       } else {
Index: /branches/eam_branch_20071130/Ohana/src/getstar/src/getstar.c
===================================================================
--- /branches/eam_branch_20071130/Ohana/src/getstar/src/getstar.c	(revision 15740)
+++ /branches/eam_branch_20071130/Ohana/src/getstar/src/getstar.c	(revision 15741)
@@ -21,4 +21,5 @@
   output.catformat = dvo_catalog_catformat (CATFORMAT);  // set the default catformat from config data
   output.catmode   = dvo_catalog_catmode (CATMODE);      // set the default catmode from config data
+  output.catflags  = LOAD_AVES | LOAD_MEAS | LOAD_SECF;
   output.Nsecfilt  = GetPhotcodeNsecfilt ();
 
Index: /branches/eam_branch_20071130/Ohana/src/libdvo/src/dvo_catalog_split.c
===================================================================
--- /branches/eam_branch_20071130/Ohana/src/libdvo/src/dvo_catalog_split.c	(revision 15740)
+++ /branches/eam_branch_20071130/Ohana/src/libdvo/src/dvo_catalog_split.c	(revision 15741)
@@ -374,7 +374,6 @@
     catalog[0].average = FtableToAverage (&ftable, &Naverage, &catalog[0].catformat, &primary);
     if (Naverage != Nrows) {
-      // XXX this is only an error if Nrows or more are available...
-      // XXX allow Nrows to go beyond end of the data?
-      fprintf (stderr, "Warning: mismatch between Naverage in PHU and Table headers (%d vs %d)\n", Naverage, Nrows);
+      // XXX this condition denotes the eof has been reached; not an error or a warning
+      // fprintf (stderr, "Warning: mismatch between Naverage in PHU and Table headers (%d vs %d)\n", Naverage, Nrows);
     }
     gfits_free_header (&header);
@@ -392,22 +391,22 @@
       return (FALSE);
     }
-    /* read Measure table header */
+    /* read Secfilt table header */
     if (!gfits_fread_header (subcat[0].f, &header)) {
       if (VERBOSE) fprintf (stderr, "can't read table measure header");
       return (FALSE);
     }
-    /* read Measure table data : format is irrelevant here */
-    if (!gfits_fread_ftable_range (subcat[0].f, &ftable, start, Nrows)) {
+    /* read Secfilt table data : format is irrelevant here */
+    if (!gfits_fread_ftable_range (subcat[0].f, &ftable, start*catalog[0].Nsecfilt, catalog[0].Naverage*catalog[0].Nsecfilt)) {
       if (VERBOSE) fprintf (stderr, "can't read table measure data");
       return (FALSE);
     }
 
-    Nexpect = Nrows * Nsecfilt;
+    Nexpect = catalog[0].Naverage * catalog[0].Nsecfilt;
     catalog[0].secfilt = FtableToSecFilt (&ftable, &Nitems, &catalog[0].catformat);
     if (Nitems != Nexpect) {
       fprintf (stderr, "Warning: mismatch between Nsecfilt items in PHU and Table headers (%d vs %d)\n", Nitems, Nexpect);
     }
-    catalog[0].Nsecf_mem = Nrows * Nsecfilt;
-    catalog[0].Nsecf_off = start * Nsecfilt;
+    catalog[0].Nsecf_mem = catalog[0].Naverage * catalog[0].Nsecfilt;
+    catalog[0].Nsecf_off = start               * catalog[0].Nsecfilt;
 
     /* if primary is defined, we were supplied with one additional average magnitude from Average
@@ -542,5 +541,5 @@
 
   /*** Average Table ***/
-  if (catalog[0].average != NULL) {
+  if ((catalog[0].catflags & LOAD_AVES) && (catalog[0].average != NULL)) {
 
     first  = 0;                    // first row in memory to write
@@ -579,5 +578,5 @@
 
   /*** Measure Table ***/
-  if (catalog[0].measure != NULL) {
+  if ((catalog[0].catflags & LOAD_MEAS) && (catalog[0].measure != NULL)) {
 
     first  = 0;                    // first row in memory to write
@@ -606,5 +605,5 @@
 
   /*** Missing Table ***/
-  if (catalog[0].missing != NULL) {
+  if ((catalog[0].catflags & LOAD_MISS) && (catalog[0].missing != NULL)) {
 
     if (catalog[0].Nmiss_off != 0) {
@@ -629,5 +628,5 @@
 
   /*** Secfilt Table ***/
-  if (catalog[0].secfilt != NULL) {
+  if ((catalog[0].catflags & LOAD_SECF) && (catalog[0].secfilt != NULL)) {
 
     first  = 0;                    // first row in memory to write
Index: /branches/eam_branch_20071130/Ohana/src/libfits/table/F_read_T.c
===================================================================
--- /branches/eam_branch_20071130/Ohana/src/libfits/table/F_read_T.c	(revision 15740)
+++ /branches/eam_branch_20071130/Ohana/src/libfits/table/F_read_T.c	(revision 15741)
@@ -71,5 +71,4 @@
 
   int Nbytes, Nread, Nskip, Nx, Ny;
-  char *buffer;
 
   /* find disk table size */
@@ -77,7 +76,11 @@
   Ny = table[0].header[0].Naxis[1];
 
+  // it is an error to ask for data starting out-of-bounds
   if (start < 0) return (FALSE);
-  if (start + Nrows >= Ny) return (FALSE);
+  if (start >= Ny) return (FALSE);
   
+  // if we request more data than is available, we will stop at the table end.
+  Nrows = MIN (Nrows, Ny - start);
+
   Nskip = start * Nx;
   Nbytes = Nrows * Nx;
@@ -85,10 +88,13 @@
 
   fseek (f, Nskip, SEEK_CUR);
-  fprintf (stderr, "file is at %ld\n", ftell(f));
-
-  Nread = fread (buffer, sizeof (char), Nbytes, f);
+
+  Nread = fread (table[0].buffer, sizeof (char), Nbytes, f);
   if (Nread != Nbytes) {
-    perror ("fits read error");
-    free (buffer);
+    if (ferror (f)) {
+      perror ("fits read error");
+    } else {
+      fprintf (stderr, "unexpected eof\n");
+    }      
+    free (table[0].buffer);
     return (FALSE);
   }
Index: /branches/eam_branch_20071130/Ohana/src/relastro/src/load_catalogs.c
===================================================================
--- /branches/eam_branch_20071130/Ohana/src/relastro/src/load_catalogs.c	(revision 15740)
+++ /branches/eam_branch_20071130/Ohana/src/relastro/src/load_catalogs.c	(revision 15741)
@@ -13,4 +13,6 @@
   for (i = 0; i < skylist[0].Nregions; i++) {
 
+    // we only allow output if we do not use a subset.  in this case,
+    // the output parameters are correctly set for catalog[i] via pcatalog
     pcatalog = subselect ? &tcatalog : &catalog[i];
 
