Fixing the removal of relationships when identitytypes are removed.
Merge remote-tracking branch 'upstream2/master'