Fixed a memory bug with similarity thresholds of 100%

Fixed a memory bug with similarity thresholds of 100%