fix to use array access