bugfix in destructor