improve merge to avoid having duplicate enrties