modified login error handling