fix logic on auth error