Fixed the error in which time was not counted correctly