diff --git a/requests_html.py b/requests_html.py
index 32145a3..f88396e 100644
--- a/requests_html.py
+++ b/requests_html.py
@@ -449,8 +449,8 @@ def user_agent(style=None) -> _UserAgent:
"""Returns a random user-agent, if not requested one of a specific
style. Defaults to a Chrome-style User-Agent.
"""
+ global useragent
if (not useragent) and style:
- global useragent
useragent = UserAgent()
return useragent[style] if style else DEFAULT_USER_AGENT