diff --git a/MagickCore/blob.c b/MagickCore/blob.c
index 0be2965..80ee5b6 100644
--- a/MagickCore/blob.c
+++ b/MagickCore/blob.c
@@ -2488,8 +2488,8 @@
                 ((int) magick[2] == 0x08))
               {
                 (void) fclose(image->blob->file);
-                image->blob->file=(FILE *) gzopen(filename,type);
-                if (image->blob->file != (FILE *) NULL)
+                image->blob->gzfile=gzopen(filename,type);
+                if (image->blob->gzfile != (gzFile) NULL)
                   image->blob->type=ZipStream;
                }
 #endif
@@ -2497,8 +2497,8 @@
             if (strncmp((char *) magick,"BZh",3) == 0)
               {
                 (void) fclose(image->blob->file);
-                image->blob->file=(FILE *) BZ2_bzopen(filename,type);
-                if (image->blob->file != (FILE *) NULL)
+                image->blob->bzfile=BZ2_bzopen(filename,type);
+                if (image->blob->bzfile != (BZFILE *) NULL)
                   image->blob->type=BZipStream;
               }
 #endif
@@ -2557,8 +2557,8 @@
           {
             if (mode == WriteBinaryBlobMode)
               type="wb";
-            image->blob->file=(FILE *) gzopen(filename,type);
-            if (image->blob->file != (FILE *) NULL)
+            image->blob->gzfile=gzopen(filename,type);
+            if (image->blob->gzfile != (gzFile) NULL)
               image->blob->type=ZipStream;
           }
         else
@@ -2566,8 +2566,8 @@
 #if defined(MAGICKCORE_BZLIB_DELEGATE)
           if (LocaleCompare(extension,".bz2") == 0)
             {
-              image->blob->file=(FILE *) BZ2_bzopen(filename,type);
-              if (image->blob->file != (FILE *) NULL)
+              image->blob->bzfile=BZ2_bzopen(filename,type);
+              if (image->blob->bzfile != (BZFILE *) NULL)
                 image->blob->type=BZipStream;
             }
           else