wrong appendIndex value bug fix