UnionFind data structure fixed.