Index: /trunk/Ohana/src/gastro2/include/gastro2.h
===================================================================
--- /trunk/Ohana/src/gastro2/include/gastro2.h	(revision 7961)
+++ /trunk/Ohana/src/gastro2/include/gastro2.h	(revision 7962)
@@ -124,4 +124,5 @@
 char PhotCodeFile[256];
 int GASTRO_MAX_NSTARS;
+int TEXTMODE;
 
 int    FORCE;
Index: /trunk/Ohana/src/gastro2/src/gargs.c
===================================================================
--- /trunk/Ohana/src/gastro2/src/gargs.c	(revision 7961)
+++ /trunk/Ohana/src/gastro2/src/gargs.c	(revision 7962)
@@ -28,4 +28,11 @@
   if ((N = get_argument (*argc, argv, "-v"))) {
     VERBOSE = TRUE;
+    remove_argument (N, argc, argv);
+  }
+
+  /* force read of image database with mismatched NSTARS & size */ 
+  TEXTMODE = FALSE;
+  if ((N = get_argument (*argc, argv, "-textmode"))) {
+    TEXTMODE = TRUE;
     remove_argument (N, argc, argv);
   }
Index: /trunk/Ohana/src/gastro2/src/greference2.c
===================================================================
--- /trunk/Ohana/src/gastro2/src/greference2.c	(revision 7961)
+++ /trunk/Ohana/src/gastro2/src/greference2.c	(revision 7962)
@@ -11,5 +11,5 @@
   Ref[0].N = 0;
   /* get stars from the USNO A catalog for the given region */
-  if (!strcmp (REFCAT, "USNO")) {
+  if (!strcasecmp (REFCAT, "USNO")) {
     getusno (&catstats, Ref);
     /* calculate Ref[0].Moff from Target & Ref dMdN, Mo */
@@ -17,5 +17,5 @@
 
   /* get stars from the USNO B catalog for the given region */
-  if (!strcmp (REFCAT, "USNOB")) {
+  if (!strcasecmp (REFCAT, "USNOB")) {
     getusnob (&catstats, Ref, 2000.0);
     /* calculate Ref[0].Moff from Target & Ref dMdN, Mo */
@@ -23,10 +23,10 @@
 
   /* get stars from the HST GSC catalog for the given region */
-  if (!strcmp (REFCAT, "GSC")) {
+  if (!strcasecmp (REFCAT, "GSC")) {
     getgsc (&catstats, Ref);
   }
   
   /* get stars from 2MASS for the given region -- add PHOTCODE check? */
-  if (!strcmp (REFCAT, "2MASS")) {
+  if (!strcasecmp (REFCAT, "2MASS")) {
     strcpy (CATDIR, TWO_MASS_DIR);
     getptolemy (&catstats, Ref);
@@ -35,5 +35,5 @@
   
   /* get stars from the DVO CATDIR for the given region */
-  if (!strcmp (REFCAT, "PTOLEMY")) {
+  if (!strcasecmp (REFCAT, "PTOLEMY")) {
     getptolemy (&catstats, Ref);
   }
@@ -56,5 +56,5 @@
 void define_region (CatStats *catstats, CmpCatalog *Target) {
    
-  int NX, NY;
+  int NX, NY, status;
   double x, y, X, Y, R, D, dX, dY, Xo, Yo;
 
@@ -68,6 +68,8 @@
   Yo = -0.5*NFIELD*NY;
 
-  catstats[0].RA[0] = catstats[0].DEC[0] =  360.0;
-  catstats[0].RA[1] = catstats[0].DEC[1] = -360.0;
+  catstats[0].RA[0] = +360.0;
+  catstats[0].RA[1] = -360.0;
+  catstats[0].DEC[0] = +90.0;
+  catstats[0].DEC[1] = -90.0;
 
   for (x = 0; x <= 1.0; x += 0.5) {
@@ -76,5 +78,8 @@
       X = x*dX + Xo;
       Y = y*dY + Yo;
-      XY_to_RD (&R, &D, X, Y, &Target[0].coords);
+      status = XY_to_RD (&R, &D, X, Y, &Target[0].coords);
+      if (!status) continue;
+      if (isinf(R) || isnan(R)) continue;
+      if (isinf(D) || isnan(D)) continue;
 
       catstats[0].RA[0]  = MIN (catstats[0].RA[0], R);
Index: /trunk/Ohana/src/gastro2/src/gstars2.c
===================================================================
--- /trunk/Ohana/src/gastro2/src/gstars2.c	(revision 7961)
+++ /trunk/Ohana/src/gastro2/src/gstars2.c	(revision 7962)
@@ -6,5 +6,5 @@
   char line[80];
   double det;
-  int NX, NY, Nskip, FoundAstrom, extend;
+  int NX, NY, Nskip, FoundAstrom, extend, naxis;
   StarData *stars;
   FILE *f;
@@ -124,7 +124,8 @@
 
   /* read from FITS table or from text table */
+  /* Is NAXIS == 0 a better test?? */
   extend = FALSE;
-  gfits_scan (&Target[0].header, "EXTEND",  "%t", 1, &extend);
-  if (extend) {
+  gfits_scan (&Target[0].header, "NAXIS",  "%t", 1, &naxis);
+  if ((naxis == 0) && !TEXTMODE) {
     Nskip = gfits_matrix_size (&Target[0].header);
     fseek (f, Nskip, SEEK_CUR); 
