Fix problem on user deletion
Fix wrong handing integrity error on register or accept invitation.