fixed undefinedIndex.