Add smart-merge, fix merge bug

* MERGE_STRATEGY_2
* fixed: merge would proceed all the way to the root