improve latency check