Fixed authentication redirect bug