For ENG-5865, fix botched refcounting