Fix time management

Hey Shiva! I send you a pull request like I said. This should fix the time management issue.