added check for Z_BUF_ERROR in zlibstreams