trying to fix refcounting