adding error handling for login