Let's handle badly formed URLs a bit better.