fix a branch condition bug in merge