fix broken isAuthenticated logic