fixes issues with handling of deliberately bad URLs