Added support for correctly typechecking array value indexing