Index: trunk/Ohana/src/opihi/cmd.data/rd.c
===================================================================
--- trunk/Ohana/src/opihi/cmd.data/rd.c	(revision 38255)
+++ trunk/Ohana/src/opihi/cmd.data/rd.c	(revision 38441)
@@ -9,4 +9,10 @@
   Buffer *buf;
 
+  int VERBOSE = FALSE;
+  if ((N = get_argument (argc, argv, "-v"))) {
+    remove_argument (N, &argc, argv);
+    VERBOSE = TRUE;
+  }
+
   int JustHead = FALSE;
   if ((N = get_argument (argc, argv, "-head"))) {
@@ -91,5 +97,5 @@
       return (FALSE);
     }
-    if (gfits_extension_is_compressed (&buf[0].header)) {
+    if (gfits_extension_is_compressed_image (&buf[0].header)) {
 	IsCompressed = TRUE;
     }
@@ -124,5 +130,5 @@
       Nword = 1;
       IsCompressed = FALSE;
-      if (gfits_extension_is_compressed (&buf[0].header)) {
+      if (gfits_extension_is_compressed_image (&buf[0].header)) {
 	if (!strcmp (CCDKeyword, "EXTNAME")) Nword = 1;
 	IsCompressed = TRUE;
@@ -198,9 +204,14 @@
     ftable.header[0].buffer = NULL;
     gfits_copy_header (&buf[0].header, ftable.header);
-    status = gfits_fread_ftable_data (f, &ftable, FALSE);  // this just reads the bytes (not even a SWAP)
-    status = gfits_uncompress_image (&buf[0].header, &buf[0].matrix, &ftable);
+
+    if (!gfits_fread_ftable_data (f, &ftable, FALSE)) { gprint (GP_ERR, "problem reading compressed image table data\n"); fclose (f); return FALSE; }
+    if (!gfits_byteswap_varlength_column (&ftable, 1)) { gprint (GP_ERR, "problem doing byteswap on compressed image metadata column\n"); fclose (f); gfits_free_table (&ftable); return FALSE; }
+    if (!gfits_uncompress_image (&buf[0].header, &buf[0].matrix, &ftable)) { gprint (GP_ERR, "problem uncompressing the image data\n"); fclose (f); gfits_free_table (&ftable); return FALSE; }
+
     // uncompressing the image leaves the format as an extension
     gfits_extended_to_primary (&buf[0].header, TRUE, "Standard FITS");
     gfits_free_table (&ftable);
+
+    status = TRUE;
     // XXX this currently does not work for a cube (we get a cube back, not a specific plane)
   } else {
@@ -239,6 +250,5 @@
   buf[0].unsign = buf[0].header.unsign;
 
-  gprint (GP_LOG, "read "OFF_T_FMT" bytes from %s into buffer %s\n", 
-	   buf[0].header.datasize + buf[0].matrix.datasize, argv[2], argv[1]);
+  if (VERBOSE) gprint (GP_LOG, "read "OFF_T_FMT" bytes from %s into buffer %s\n", buf[0].header.datasize + buf[0].matrix.datasize, argv[2], argv[1]);
 
   blank = 0xffff;
