fix the redirect loop