fixed the remove_duplicate_ functions