correct array index