fix access denied redirect loop bug