bug fix in time comparison