fixed time counting bug