fix for relationship error with deleted entities