Fix the undefined index url and throws an more explicit exception