fixed bug on redirect