add toArray method