Index: /trunk/Mars/mcore/zofits.h
===================================================================
--- /trunk/Mars/mcore/zofits.h	(revision 17295)
+++ /trunk/Mars/mcore/zofits.h	(revision 17296)
@@ -378,5 +378,5 @@
 
         /// Shrinks a catalog that is too long to fit into the reserved space at the beginning of the file.
-        uint32_t ShrinkCatalog()
+        const uint32_t ShrinkCatalog()
         {
             //add empty row to get either the target number of rows, or a multiple of the allowed size
@@ -564,10 +564,10 @@
         bool SetNumThreads(uint32_t num)
         {
-            if (is_open())
-            {
-#ifdef __EXCEPTIONS
-                throw std::runtime_error("File must be closed before changing the number of compression threads");
+            if (tellp()>0)
+            {
+#ifdef __EXCEPTIONS
+                throw std::runtime_error("Number of threads cannot be changed in the middle of writing a file");
 #else
-                gLog << ___err___ << "ERROR - File must be closed before changing the number of compression threads" << std::endl;
+                gLog << ___err___ << "ERROR - Number of threads cannot be changed in the middle of writing a file" << std::endl;
 #endif
                 return false;
