Fix some bugs of timer.