Index: trunk/Mars/mcore/ofits.h
===================================================================
--- trunk/Mars/mcore/ofits.h	(revision 13998)
+++ trunk/Mars/mcore/ofits.h	(revision 13999)
@@ -614,12 +614,12 @@
         h.End();
 
-        Checksum sum = h.WriteHeader(*this);
-        size_t offset = tellp();
+        const Checksum sum = h.WriteHeader(*this);
+
         h.SetStr("CHECKSUM", sum.str());
-        //header gets updated here. cannot direcly return this otherwise
-        //1. wrong checksum would be returned (does not matter... now)
-        //2. cannot restore the correct location of the file's cursor
+
+        const size_t offset = tellp();
         h.WriteHeader(*this);
         seekp(offset);
+
         return sum;
     }
