write trie ptr ref's test case and fix some bugs.