Fixed duplicate detection for custom rules