Corrected code to contemplate missing possible URLs