Fix error when the input URL has no valid host