fixing array access