added additional error handling to login required