fixed redirect code