add utilities: match_path and length