fix bug in merge