Fixed the union-find allocation issue