Fix huffman encoding (so far)