fixing bug with trie