Adding a weak ref hook.