Fix insert index on flushing