Make nextIndex safer
Correct (robust) log committing