cat_merge pointer bug fixed and union-find implemented