Fix a couple small bugs and URL encode paths