Make toArray support objects with public properties