Added additional check for anonymous users