fix merging chains