fixed the build out of index bug