fix bugs / add tests for recursive relationships