edit distance bug fixed