corrected the ordered insertion of nodes in the trie