Work around a bug in compress/zlib by buffering the data