boundsCheck was off by one