Merge some changes from GatherMergeRewrite into Catalog
Fix integration issues.