Please change the line:

147:return $html ? l($term->name, "taxonomy/term/$tid") : check_plain($term->name);

by

    return $html ? l($term->name, taxonomy_term_path($term)) : check_plain($term->name);

thanks.