Modify slice for v8 optimization