zlib fixes

Fix some issues with zlib and raw compression.