add error handling for services