Fix a bug in the local duplicates search algorithm