Code to fix merging of huffman trees