correcting duplicate merge code