Redirect loop fix