fixed the case for redirect loops and other bad stuff