adding override method for toArray()