separated path parsing functions into _to_path_head and _to_path_tail