Fixing the if statement as it lead to 'TypeError: Parameter 'url' must be a string, not undefined' in certain cases