fixed a bug about redirect when auth error