fix redirect loop