fix bug with redirect