improved testing of curl error code