bug fix on redirect