make_index: make index replacement atomic