Protect from cycles in get_path