Adding check for undefined redirect URLs