Fix to mark duplicates