OutOfBound bug fix