Fix replication lag written many times and tests accordingly