protect against relation loops, part 2. fixes #2096
Merge pull request #2097 from tyrasd/patch-self-referencing-relations

protect against relation loops, part 2.