Fix time count bug