Fix for NoSuchElementException in TranspositionDetector class.