arraylist modified, bugfix in to_array()