fixing array index