Fixed some time comparsion logic.