Fixed a potential ArrayIndexOutOfBoundsException

Unknown cause