Fix redirect url generation