fixing time comparison bug