Update slice append algorithm

Update slice append algorithm according to growslice1.
Merge pull request #4 from NanXiao/patch-2

Update slice append algorithm