Fix log index calculation after clearing the log.