added back special case for root dir in _to_regex