Added a check for anonymous user