safer destructor