Index: trunk/psLib/src/fits/psFitsImage.c
===================================================================
--- trunk/psLib/src/fits/psFitsImage.c	(revision 18392)
+++ trunk/psLib/src/fits/psFitsImage.c	(revision 18420)
@@ -7,6 +7,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.32 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2008-07-01 04:26:26 $
+ *  @version $Revision: 1.33 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2008-07-04 03:10:36 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -660,4 +660,13 @@
     }
 
+    // This forces a re-scan of the header to ensure everything's kosher.
+    // Without this, compressed HDUs have been written out with PCOUNT=0 and TFORM1 not correctly set.
+    ffrdef(fits->fd, &status);
+    if (psFitsError(status, true, "Could not re-scan HDU.")) {
+        success = false;
+        goto INSERT_DONE;
+    }
+
+
  INSERT_DONE:
     psFree(diskImage);
@@ -667,4 +676,5 @@
         psFree(compress);
     }
+
     return success;
 }
