Fixed an ArrayOutOfBounds error that could occur under certain circumstances.