Fix exception when login failed.