Fix crash on login with invalid credentials