ENG-5880: Fix bad usage of weak references.