Not sure what I've done wrong...

indeed:
That's never a problem because the lowest value is MIN (which is 1) and the highest 127, and the array is 0 to 128.

Wrong. The 128 element array is from 0 TO 127, NOT 128.