Added a check to see whether a field is really a foreign key before
trying to fetch its relations.