implemented rebuildValueIndex.