properly handle login errors