Fix type() return value and rename arrayType to isArray