Using weakref to avoid cyclic reference (Issue #26)