changes to sort OutOfBoundsException