Index: trunk/Mars/mfileio/MFitsArray.cc
===================================================================
--- trunk/Mars/mfileio/MFitsArray.cc	(revision 19261)
+++ trunk/Mars/mfileio/MFitsArray.cc	(revision 19288)
@@ -73,5 +73,5 @@
 // status is set to kFALSE if some data cannot be stored in a FITS table,      
 // for example more than 1 dimensional arrays.                                 
-MClonesArrayHelper::MClonesArrayHelper(TClonesArray * clonesArray, MLog * log, 
+MClonesArrayHelper::MClonesArrayHelper(const TClonesArray * clonesArray, MLog * log,
                                        Bool_t & status)
   :  fClonesArray(clonesArray) 
Index: trunk/Mars/mfileio/MFitsArray.h
===================================================================
--- trunk/Mars/mfileio/MFitsArray.h	(revision 19261)
+++ trunk/Mars/mfileio/MFitsArray.h	(revision 19288)
@@ -50,5 +50,5 @@
 {
    // data of this TClonesArray are written to fFitsTable               
-   TClonesArray *  fClonesArray;  
+   const TClonesArray *  fClonesArray;
 
 
@@ -66,5 +66,5 @@
 
 public:
-   MClonesArrayHelper(TClonesArray * clonesArray, MLog * log, Bool_t & status);
+   MClonesArrayHelper(const TClonesArray * clonesArray, MLog * log, Bool_t & status);
    MClonesArrayHelper(const MClonesArrayHelper & clHelper);
 
Index: trunk/Mars/mfileio/MWriteFitsFile.cc
===================================================================
--- trunk/Mars/mfileio/MWriteFitsFile.cc	(revision 19261)
+++ trunk/Mars/mfileio/MWriteFitsFile.cc	(revision 19288)
@@ -811,5 +811,5 @@
       string comment(dataMember->GetTitle());
       string::size_type pos1, pos2;
-      if ((pos1 = comment.find(178)) != string::npos)
+      if ((pos1 = comment.find('\xb2')) != string::npos)
          comment.replace(pos1, 1, "**2");
 
@@ -902,6 +902,5 @@
          {
          // special treatment for classes
-          uint32_t arraySize = 0;
-          TString typeName;
+          const char *ptr = reinterpret_cast<char*>(baseAdr) + dataMember->GetOffset();
 
           if (strncmp(dataMember->GetTrueTypeName(), "MArray", 6) == 0)
@@ -909,10 +908,9 @@
               if (strcmp(dataMember->GetTrueTypeName(), "MArrayS*") == 0)
               {
-                  typeName = "UShort_t";
-                  arraySize = (*((MArrayS**)((char*)baseAdr + dataMember->GetOffset())))->GetSize();
+                  const MArrayS *arr = *reinterpret_cast<MArrayS* const*>(ptr);
                   InitSingleColumn(tableName,
-                                   arraySize,
-                                   typeName.Data(),
-                                   (char*)(*((MArrayS**)((char*)baseAdr + dataMember->GetOffset())))->GetArray(),
+                                   arr->GetSize(),
+                                   "UShort_t",
+                                   (char*)arr->GetArray(),
                                    colName.Data(),
                                    unit,
@@ -921,10 +919,9 @@
               else if (strcmp(dataMember->GetTrueTypeName(), "MArrayB*") == 0)
               {
-                      typeName = "UChar_t";
-                      arraySize = (*((MArrayB**)((char*)baseAdr + dataMember->GetOffset())))->GetSize();
+                      const MArrayB *arr = *reinterpret_cast<MArrayB* const*>(ptr);
                       InitSingleColumn(tableName,
-                                     arraySize,
-                                     typeName.Data(),
-                                     (char*)(*((MArrayB**)((char*)baseAdr + dataMember->GetOffset())))->GetArray(),
+                                     arr->GetSize(),
+                                     "UChar_t",
+                                     (char*)arr->GetArray(),
                                      colName.Data(),
                                      unit,
@@ -933,10 +930,9 @@
               else if (strcmp(dataMember->GetTrueTypeName(), "MArrayF*") == 0)
               {
-                      typeName = "TFloat_t";
-                      arraySize = (*((MArrayF**)((char*)baseAdr + dataMember->GetOffset())))->GetSize();
+                      const MArrayF *arr = *reinterpret_cast<MArrayF* const*>(ptr);
                       InitSingleColumn(tableName,
-                                     arraySize,
-                                     typeName.Data(),
-                                     (char*)(*((MArrayF**)((char*)baseAdr + dataMember->GetOffset())))->GetArray(),
+                                     arr->GetSize(),
+                                     "TFloat_t",
+                                     (char*)arr->GetArray(),
                                      colName.Data(),
                                      unit,
@@ -959,5 +955,5 @@
             MClonesArrayHelper * clHelper;
 
-            TClonesArray * cloneArray = (TClonesArray*)((char*)baseAdr + dataMember->GetOffset());
+            const TClonesArray * cloneArray = reinterpret_cast<const TClonesArray*>(ptr);
             Bool_t status;
             clHelper = new MClonesArrayHelper(cloneArray, fLog, status);
