Fix redirect infinite loop