Index: /trunk/Mars/mcore/ofits.h
===================================================================
--- /trunk/Mars/mcore/ofits.h	(revision 15124)
+++ /trunk/Mars/mcore/ofits.h	(revision 15125)
@@ -121,5 +121,5 @@
         }
 
-        bool check()
+        bool check(bool trim=false)
         {
             if (!FormatKey())
@@ -129,6 +129,9 @@
                 return false;
 
-            const size_t sz = CalcSize();
-            if (sz>80)
+            size_t sz = CalcSize();
+            if (sz<=80)
+                return true;
+
+            if (!trim)
             {
                 ostringstream sout;
@@ -138,9 +141,31 @@
 #else
                 gLog << ___err___ << "ERROR - " << sout.str() << endl;
+#endif
                 return false;
-#endif
             }
 
-            return true;
+            //looks like something went wrong. Maybe entry is too long ?
+            //try to remove the comment
+            comment = "";
+
+            sz = CalcSize();
+            if (sz<=80)
+            {
+#ifndef __EXCEPTIONS
+                ostringstream sout;
+                sout << "Size " << sz << " of entry for key '" << key << "' exceeds 80 characters... removed comment.";
+                gLog << ___warn___ << "WARNING - " << sout.str() << endl;
+#endif
+                return true;
+            }
+
+            ostringstream sout;
+            sout << "Size " << sz << " of entry for key '" << key << "' exceeds 80 characters even without comment.";
+#ifdef __EXCEPTIONS
+            throw runtime_error(sout.str());
+#else
+            gLog << ___err___ << "ERROR - " << sout.str() << endl;
+            return false;
+#endif
         }
 
@@ -257,19 +282,6 @@
         entry.changed = true;
 
-        if (!entry.check())
-        {
-            if (!fCommentTrimming)
-                return false;
-
-            //looks like something went wrong. Maybe entry is too long ?
-            //try to remove the comment
-            entry.comment = "";
-            if (!entry.check())
-                return false;
-
-#ifdef __MARS__
-            gLog << ___warn___ << "WARNING - Removed comment from over-sized entry " << key << endl;
-#endif
-        }
+        if (!entry.check(fCommentTrimming))
+            return false;
 
         fKeys.push_back(entry);
@@ -460,5 +472,5 @@
         {
             ostringstream sout;
-            sout << "Header already writtenm, no new column can be defined... ignoring column '" << name << "'";
+            sout << "Header already written, no new column can be defined... ignoring column '" << name << "'";
 #ifdef __EXCEPTIONS
             throw runtime_error(sout.str());
