Fixing the crash with weak references.