Fixed of ArrayIndexOutOfBounds. Minor changes for errors during the demo test