Fixed bug of wrong-working unique function on merging