Corrections to sliceString function