fixed a bug in the time checking