fix bug: anonymous user not logged in by default
resolve runtime warning