This fixes the apparent scope and comparison issues when calling a foreign key relation.