Fixed index out of range