fix string-slice function bug