Fix removal of memberships if a replacment_for relationship is broken.

Close #36.