Fixes in merge functions