Fix bug in update_relationships found by the test suite.
Fix thing that I broke in c62fb862056de8a537f9d4edf2f1db59cb9fc887

I don't know how I did that, or why I thought it was broken back then.