Fix refcounts and low memconditions