update index and pre position