fixed bug in last calc