Fix: correct calculation of temp