ticks.cpp: fix bug NaN