Fixed weakref being valid after reload (#374)