Fix bugs in Trie