Added safety check for temperature