Attempt to fix wrongly encoded urls and nicer error handling