Fix: Proper lcp and hash calculation