Improve login error handling