open index file and fix ptr bug