Bug fix: only update CachePosition with a new index.