can't cast the result of ArrayAccess to an array