fix a crash when login failed