Remove duplicates of free variables