Fix error when uri.pathname is not set.