Index: /trunk/Mars/mcore/fits.h
===================================================================
--- /trunk/Mars/mcore/fits.h	(revision 17606)
+++ /trunk/Mars/mcore/fits.h	(revision 17607)
@@ -265,5 +265,5 @@
             num_rows      = is_compressed ? Get<size_t>("ZNAXIS2") : Get<size_t>("NAXIS2");
             num_cols      = Get<size_t>("TFIELDS");
-            datasum       = is_compressed ? Get<int64_t>("ZDATASUM", -1) : Get<int64_t>("DATASUM", -1);
+            datasum       = is_compressed ? Get<int64_t>("DATASUM", -1) : Get<int64_t>("DATASUM", -1);
 //cout << "IS COMPRESSED =-========= " << is_compressed << " " << Get<size_t>("NAXIS1") << endl;
             size_t bytes = 0;
Index: /trunk/Mars/mcore/zfits.h
===================================================================
--- /trunk/Mars/mcore/zfits.h	(revision 17606)
+++ /trunk/Mars/mcore/zfits.h	(revision 17607)
@@ -20,5 +20,5 @@
     // Basic constructor
     zfits(const std::string& fname, const std::string& tableName="", bool force=false)
-        : fCatalogInitialized(false), fNumTiles(0), fNumRowsPerTile(0), fCurrentRow(-2), fHeapOff(0), fTileSize(0)
+        : fCatalogInitialized(false), fNumTiles(0), fNumRowsPerTile(0), fCurrentRow(-1), fHeapOff(0), fTileSize(0)
     {
         open(fname.c_str());
@@ -29,5 +29,5 @@
     // Alternative contstructor
     zfits(const std::string& fname, const std::string& fout, const std::string& tableName, bool force=false)
-        : fCatalogInitialized(false), fNumTiles(0), fNumRowsPerTile(0), fCurrentRow(-2), fHeapOff(0), fTileSize(0)
+        : fCatalogInitialized(false), fNumTiles(0), fNumRowsPerTile(0), fCurrentRow(-1), fHeapOff(0), fTileSize(0)
     {
         open(fname.c_str());
@@ -316,5 +316,5 @@
             // seek for the sub tile. If we were just reading the previous one
             // we can skip that.
-            if (!isNextTile)
+            if (!isNextTile || requestedTile==0)
             {
                 // step to the beginnig of the super tile
@@ -335,5 +335,4 @@
             // this is now the beginning of the sub-tile we want to read
             const int64_t subTileStart = tellg() - fHeapOff;
-
             // calculate the 32 bits offset of the current tile.
             const uint32_t offset = (subTileStart + fHeapFromDataStart)%4;
@@ -387,4 +386,5 @@
             if (isNextTile)
             {
+//                std::cout << "Updating checksum" << std::endl;
                 // Padding for checksum calculation
                 memset(fCompressedBuffer.data(),   0, offset);
