Fix invalid urls

This fixes #116.

Sometimes, the parsed urls are invalid because of some whitespace add
the beginning/end of the url, or because of a missing uri sheme. I added a helper function fix_url.