Added support for weak references