Replaced __del__ with weakref callback