Fix refcounts issues.