added error handling to requests