Fixed infinite redirect caused by my poor logic