Change function toArray()