Fix uninitialized loop in huffman writing