correct toArray method