Tweaks to duplicate detection