Don't use instantiateWithType when creating new relationships to avoid type mismatch.
Fixed and updated tests.