switch substring to slice for v8