Fix bug with pathname being extra-expanded.