SWITCHYARD-1851 improve merge code to properly match transformers