fix errors in build_half_trie