Fixed infinite redirect loop