changed similar-1-to-n to similar-n-to-nm to fix a bug
instead of selecting first mapping, check all mapping to see which one has name matches