Latency compensation