fix temperature conversion error, replace goto with while