Added error checking if curl call fails