Fix the bug about remove_duplicates.