Fix crashing when encounts invalid url