Fix redirect handling