fix conditional decrement of log_index.