Fix potential System.arrayCopy error