Fixes issue where empty items were not encoded
Fixing up some issues with building the huff tree