fix bug IndexOutOfBound