change the weakref handling