BUG: fix uri_to_path and add tests.