Fix some bugs in ultra-merge