import ref count functions & scope clean