Fixed nullpointer from System.arrayCopy