Fix replication lag computation bug