Minor fix in thermal's algorithm.