change best_match_len to -1 to allow for 0-length (ie root) entries to be looked up correctly