Little bugs fixed

Bugs of calculating time
Add some comments