added check for relationship direction