use a better mechanism of preventing redirects