Fix in rename and merging function