fix a bug where redirect is not actually returned