fix client redirect code