Update Manager and Core refcounting to support threadsafe refcounts.