fixed a subtle bug in huffman distance/length encoding