fix bug when stream is piped to zlib stream