Fix bug in Remove duplicate problem