correction in edit dist calculation