Fix the exception handling for relationships