Add error checking to avoid crashing when zlib cannot be loaded.