Fix trie pair merging to handle diverge node rewrites