trie: make insert more flexible to different usage styles