improve slicing/subarray operation