added error checking to thermocouple functions