mergeResult bugFix and refactor