Index: trunk/FACT++/src/fitsCompressor.cc
===================================================================
--- trunk/FACT++/src/fitsCompressor.cc	(revision 16819)
+++ trunk/FACT++/src/fitsCompressor.cc	(revision 16820)
@@ -1300,5 +1300,5 @@
             {
                 case FACT_RAW:
-                    if (head.numProcs == 1)
+//                    if (head.numProcs == 1)
                         compressedOffset += compressUNCOMPRESSED(&(_compressedBuffer[threadIndex][compressedOffset]), &(_transposedBuffer[threadIndex][offset]), thisRoundNumRows, _columns[i].sizeOfElems(), _columns[i].numElems());
                 break;
@@ -1656,11 +1656,11 @@
         //get header structures
         BlockHeader rawHeader;
-        BlockHeader smoothmanHeader(0, FACT_ROW_MAJOR, 3);
+        BlockHeader smoothmanHeader(0, FACT_ROW_MAJOR, 2);
         vector<uint16_t> rawProcessings(1);
         rawProcessings[0] = FACT_RAW;
-        vector<uint16_t> smoothmanProcessings(3);
+        vector<uint16_t> smoothmanProcessings(2);
         smoothmanProcessings[0] = FACT_SMOOTHING;
         smoothmanProcessings[1] = FACT_HUFFMAN16;
-        smoothmanProcessings[2] = FACT_RAW;
+//        smoothmanProcessings[2] = FACT_RAW;
 
         //first lets see if we do have an explicit request
Index: trunk/Mars/mcore/zfits.h
===================================================================
--- trunk/Mars/mcore/zfits.h	(revision 16819)
+++ trunk/Mars/mcore/zfits.h	(revision 16820)
@@ -168,5 +168,5 @@
     vector<char> fTransposedBuffer; ///<intermediate buffer to transpose the rows
     vector<char> fCompressedBuffer; ///<compressed rows
-    vector<char> fColumnOrdering; ///< ordering of the column's rows
+    vector<char> fColumnOrdering;   ///< ordering of the column's rows. Can change from tile to tile.
 
     size_t fNumTiles;       ///< Total number of tiles
@@ -180,4 +180,5 @@
     vector<vector<size_t> >                  fTileOffsets; ///< offset from start of tile of a given compressed column
 
+    // Get buffer space
     void AllocateBuffers()
     {
@@ -255,4 +256,5 @@
             clear(rdstate()|ios::badbit);
     }
+
     //overrides fits.h method with empty one
     //work is done in ReadBinaryRow because it requires volatile data from ReadBinaryRow
@@ -261,5 +263,6 @@
 
     }
-    // Compressed versin of the read row
+
+    // Compressed version of the read row
     bool ReadBinaryRow(const size_t &rowNum, char *bufferToRead)
     {
@@ -386,6 +389,7 @@
     }
 
+    // Apply the inverse transform of the integer smoothing
     uint32_t UnApplySMOOTHING(int16_t*   data,
-                              uint32_t numElems)
+                              uint32_t   numElems)
     {
         //un-do the integer smoothing
@@ -395,6 +399,8 @@
         return numElems*sizeof(uint16_t);
     }
+
     // Data has been read from disk. Uncompress it !
-    void UncompressBuffer(const uint32_t &catalogCurrentRow, const uint32_t &thisRoundNumRows)
+    void UncompressBuffer(const uint32_t &catalogCurrentRow,
+                          const uint32_t &thisRoundNumRows)
     {
         char *dest = fTransposedBuffer.data();
@@ -419,13 +425,12 @@
             const char *src = fCompressedBuffer.data()+compressedOffset+sizeof(BlockHeader)+sizeof(uint16_t)*head->numProcs;
 
-            for (uint32_t j=head->numProcs;j != 0; j--)
+            for (int32_t j=head->numProcs-1;j >= 0; j--)
             {
                 uint32_t sizeWritten=0;
 
-                switch (head->processings[j-1])
+                switch (head->processings[j])
                 {
                     case FACT_RAW:
-                            if (head->numProcs == 1)
-                                sizeWritten = UncompressUNCOMPRESSED(dest, src, numRows*numCols, col.size);
+                            sizeWritten = UncompressUNCOMPRESSED(dest, src, numRows*numCols, col.size);
                     break;
                     case FACT_SMOOTHING:
@@ -445,5 +450,5 @@
                 }
                 //increment destination counter only when processing done.
-                if (j==1) dest+= sizeWritten;
+                if (j==0) dest+= sizeWritten;
             }
         }
