Replace zlib port with erlang code