fixed the bug of ArrayIndexOutOfBoundsException