Fixed bugs in trie