Index: trunk/Mars/mcore/fits.h
===================================================================
--- trunk/Mars/mcore/fits.h	(revision 17258)
+++ trunk/Mars/mcore/fits.h	(revision 17259)
@@ -564,5 +564,5 @@
     }
 
-    void Constructor(const string &fname, string fout, const string& tableName, bool force)
+    void Constructor(const string &fname, string fout, const string& tableName, bool force, int tableNumber=-1)
     {
         char simple[10];
@@ -570,4 +570,6 @@
         if (!good())
             return;
+
+        int current_table = 0;
 
         if (memcmp(simple, "SIMPLE  = ", 10))
@@ -649,10 +651,19 @@
                 // skip the current table?
                 if ((!tableName.empty() &&         tableName!=fTable.Get<string>("EXTNAME")) ||
-                    ( tableName.empty() && "ZDrsCellOffsets"==fTable.Get<string>("EXTNAME")))
+                    ( tableName.empty() && "ZDrsCellOffsets"==fTable.Get<string>("EXTNAME")) ||
+                    (tableNumber != -1))
                 {
+                    if (current_table == tableNumber)
+                    {
+                        fBufferRow.resize(fTable.bytes_per_row + 8-fTable.bytes_per_row%4);
+                        fBufferDat.resize(fTable.bytes_per_row);
+
+                        break;
+                    }
                     const streamoff skip = fTable.GetTotalBytes();
                     seekg(skip, ios_base::cur);
 
                     fChkHeader.reset();
+                    current_table++;
 
                     continue;
