fix redirect codes bug and fix unicode bug