Index: /trunk/Mars/mcore/zofits.h
===================================================================
--- /trunk/Mars/mcore/zofits.h	(revision 17284)
+++ /trunk/Mars/mcore/zofits.h	(revision 17285)
@@ -314,6 +314,4 @@
             fTable.num_rows++;
 
-            DrsOffsetCalibrate(target_location);
-
             if (fTable.num_rows % fNumRowsPerTile != 0)
             {
@@ -324,4 +322,5 @@
             // use the least occupied queue
             const auto imin = std::min_element(fCompressionQueues.begin(), fCompressionQueues.end());
+
             if (!imin->emplace(InitNextCompression()))
                 throw std::runtime_error("The compression queues are not started. Did you close the file before writing this row?");
@@ -631,12 +630,10 @@
             //Really do not understand what's wrong...
             //calibrate data if required
-            //const uint32_t thisRoundNumRows  = (target.num_rows%fNumRowsPerTile) ? target.num_rows%fNumRowsPerTile : fNumRowsPerTile;
-//            for (uint32_t i=0;i<thisRoundNumRows;i++)
-//            {
-//                char* target_location = target.src.get() + fRealRowWidth*i;
-//                cout << "Target Location there...." << hex << static_cast<void*>(target_location) << endl;
-//                DrsOffsetCalibrate(target_location);
-//            }
-
+            const uint32_t thisRoundNumRows  = (target.num_rows%fNumRowsPerTile) ? target.num_rows%fNumRowsPerTile : fNumRowsPerTile;
+            for (uint32_t i=0;i<thisRoundNumRows;i++)
+            {
+                char* target_location = target.src.get() + fRealRowWidth*i;
+                DrsOffsetCalibrate(target_location);
+            }
 #ifdef __EXCEPTIONS
             try
@@ -644,5 +641,5 @@
 #endif
                 //transpose the original data
-                copyTransposeTile(target.src.get(), target.transposed_src.get());
+                copyTransposeTile(target.src.get(), target.transposed_src.get(), target.num_rows);
 
                 //compress the buffer
@@ -787,7 +784,7 @@
         /// @param src buffer hosting the regular, row-ordered data
         /// @param dest the target buffer that will receive the transposed data
-        void copyTransposeTile(const char* src, char* dest)
-        {
-            const uint32_t thisRoundNumRows = (fTable.num_rows%fNumRowsPerTile) ? fTable.num_rows%fNumRowsPerTile : fNumRowsPerTile;
+        void copyTransposeTile(const char* src, char* dest, uint32_t num_rows)
+        {
+            const uint32_t thisRoundNumRows = (num_rows%fNumRowsPerTile) ? num_rows%fNumRowsPerTile : fNumRowsPerTile;
 
             //copy the tile and transpose it
