added check if relation exists to getRelationByName()