fix indexOutOfBounds exception
Merge branch 'indexoutofbounds' into latest