add fixes for exceptions in __del__