added error handling for pivotal call