Fix the refcounting