add error checking for curl request