Fix out of bounds bug.  Seems to be working perfectly.