fix merge functions