Hopefully this fixes the out of bounds exception.

But I can't test it right now...