updating toArray() override method