Fixed login method to include error