fixing authentication redirect