Fix crash when registering an account