fix Levenshtein edit distance implementation