add redirect loop protection