Fixed a possible error during recursive relationships.