Fix bug for merging