added toArray support