Off-by-one error.
Everything seems to work. Except the actual deduplication.