replace the index