Fixed bug in deduplication algorithm.