Fix a bug with false negative bad URI

See http://stackoverflow.com/questions/5374470/uriinvalidurierror-bad-uriis-not-uri