#991 Fix a bug in validate_redirect()