added extra check for malformed url