Index: /trunk/Ohana/src/libfits/matrix/F_compress_M.c
===================================================================
--- /trunk/Ohana/src/libfits/matrix/F_compress_M.c	(revision 16854)
+++ /trunk/Ohana/src/libfits/matrix/F_compress_M.c	(revision 16855)
@@ -114,6 +114,16 @@
   have_ztension = gfits_scan (header, "ZTENSION", "%s", 1, exttype);
 
-  if (!have_zsimple && !have_ztension) ESCAPE;
-  if ( have_zsimple &&  have_ztension) ESCAPE;
+  // this is a very bogus case: we cannot have both keywords
+  if (have_zsimple && have_ztension) ESCAPE;
+
+  // if neither are present, we have an image that is not really following the standard:
+  // assume it is a PHU
+  if (!have_zsimple && !have_ztension) {
+    header->simple = TRUE;
+    gfits_extended_to_primary (header, header->simple, "Image data");
+
+    MOD_KEYWORD ("ZEXTEND",  "EXTEND",   "%t", &header->extend, header->extend);
+    MOD_KEYWORD ("ZBLOCKED", "BLOCKED",  "%t", &header->extend, header->extend);
+  }
 
   // have_zsimple : image comes from a PHU
@@ -125,5 +135,8 @@
     MOD_KEYWORD ("ZEXTEND",  "EXTEND",   "%t", &header->extend, header->extend);
     MOD_KEYWORD ("ZBLOCKED", "BLOCKED",  "%t", &header->extend, header->extend);
-  } else {
+  } 
+
+  // have_ztension : image comes from an extension
+  if (have_ztension) {
     gfits_delete (header, "ZTENSION", 1);
     gfits_modify_extended (header, exttype, "Image extension");
