Fix IndexOutOfBoundsException when a listmode is set.