Invalid index size

@karllindmark 

fix for java.lang.IndexOutOfBoundsException: Invalid index 10, size is 10
https://www.bugsense.com/dashboard/project/f42265ac/errors/1435018136