Index: /tags/ipp-20100623/magic/remove/src/streaksremove.c
===================================================================
--- /tags/ipp-20100623/magic/remove/src/streaksremove.c	(revision 28512)
+++ /tags/ipp-20100623/magic/remove/src/streaksremove.c	(revision 28513)
@@ -577,5 +577,5 @@
 }
 
-static void 
+static void
 setStreakBits(psImage *maskImage, psU32 maskStreak)
 {
@@ -644,5 +644,5 @@
             if (exciseAll) {
                 strkGetMaskValues(sf);
-                
+
                 // add the STREAK bit to the mask image pixels
                 setStreakBits(sf->inMask->image, sf->maskStreak);
@@ -941,9 +941,5 @@
         psArray *inTable = psFitsReadTable(in->fits);
         if (!inTable) {
-            psErrorStackPrint(stderr, "failed to read tablle in %s", in->resolved_name);
-            streaksExit("", PS_EXIT_DATA_ERROR);
-        }
-        if (!inTable->n) {
-            psErrorStackPrint(stderr, "table in %s is empty", in->resolved_name);
+            psErrorStackPrint(stderr, "failed to read table in %s", in->resolved_name);
             streaksExit("", PS_EXIT_DATA_ERROR);
         }
Index: /tags/ipp-20100623/psLib/src/fits/psFitsImage.c
===================================================================
--- /tags/ipp-20100623/psLib/src/fits/psFitsImage.c	(revision 28512)
+++ /tags/ipp-20100623/psLib/src/fits/psFitsImage.c	(revision 28513)
@@ -415,5 +415,5 @@
     if (fits_read_subset(fits->fd, info->fitsDatatype, info->firstPixel, info->lastPixel,
                          info->increment, nullValue, output->data.V[0], &anynull, &status) != 0) {
-        psFitsError(status, true, "Reading FITS file failed.");
+        psFitsError(status, true, "Reading FITS file %s failed.", fits->fd->Fptr->filename);
         return false;
     }
Index: /tags/ipp-20100623/psLib/src/fits/psFitsTable.c
===================================================================
--- /tags/ipp-20100623/psLib/src/fits/psFitsTable.c	(revision 28512)
+++ /tags/ipp-20100623/psLib/src/fits/psFitsTable.c	(revision 28513)
@@ -39,4 +39,25 @@
 
     int status = 0;                     // CFITSIO status
+
+    // Check for empty table, which looks like an image
+    int hdutype;                        // Type of HDU
+    fits_get_hdu_type(fits->fd, &hdutype, &status);
+    if (psFitsError(status, true, "Could not determine the HDU type.")) {
+        return -1;
+    }
+    if (hdutype == IMAGE_HDU) {
+        // It could be an empty table
+        int naxis = 0;                  // Dimensions of image
+        if (fits_get_img_dim(fits->fd, &naxis, &status) != 0) {
+            psFitsError(status, true, "Unable to determine dimension for table.");
+            return -1;
+        }
+        if (naxis != 0) {
+            psFitsError(PS_ERR_BAD_FITS, true, "Current FITS HDU is not a table.");
+            return -1;
+        }
+        return 0;
+    }
+
     long numRows;                       // Number of rows
     if (fits_get_num_rows(fits->fd, &numRows, &status)) {
@@ -48,9 +69,10 @@
 }
 
+
 // Check the FITS file in preparation for reading a table
 static bool readTableCheck(const psFits *fits // FITS file
                            )
 {
-    PS_ASSERT_FITS_NON_NULL(fits, NULL);
+    PS_ASSERT_FITS_NON_NULL(fits, false);
 
     if (psFitsGetExtNum(fits) == 0 && !psFitsMoveExtNum(fits, 1, false)) {
@@ -58,5 +80,4 @@
         return false;
     }
-
 
     // check that we are positioned on a table HDU
@@ -69,15 +90,14 @@
     if (hdutype == IMAGE_HDU) {
         // It could be an empty table
-        long size = 0;                  // Size of 'table'
-        if (fits_get_num_rows(fits->fd, &size, &status)) {
-            psFitsError(status, true, "Unable to determine size of table.");
+        int naxis = 0;                  // Dimensions of image
+        if (fits_get_img_dim(fits->fd, &naxis, &status) != 0) {
+            psFitsError(status, true, "Unable to determine dimension for table.");
             return false;
         }
-        if (size != 0) {
+        if (naxis != 0) {
             psFitsError(PS_ERR_BAD_FITS, true, "Current FITS HDU is not a table.");
             return false;
         }
-    }
-    if (hdutype != ASCII_TBL && hdutype != BINARY_TBL) {
+    } else if (hdutype != ASCII_TBL && hdutype != BINARY_TBL) {
         psError(PS_ERR_BAD_FITS, true, _("Current FITS HDU is not a table."));
         return false;
