fix exception when login fails