Fixed index bug