Fixed issues w.r.t. huffman encoding