Fixed bug in merge