implemented the dtor for array