fix latency calculations