Fix issues in type merging