fixing toArray