fixed subtle problem due to differences between splice and slice.