Fix fatal error when a user is logged out