fix array access