Small performance improvement when checking for duplicate folders.