Fix multiple out of bounds bugs.
Don't split after end of array.