fix the infinite redirect