Fixed ensureAuthenticated()