use breadth-first search in unref()