diff --git a/quickstats/components/workspaces/xml_ws_builder.py b/quickstats/components/workspaces/xml_ws_builder.py
index b32d2c99b52aecc3f2235b19d98da74b5ea5df1e..b784bd5ab774893154f9a80f6c03ebb6c5b85101 100644
--- a/quickstats/components/workspaces/xml_ws_builder.py
+++ b/quickstats/components/workspaces/xml_ws_builder.py
@@ -1655,7 +1655,7 @@ class XMLWSBuilder(XMLWSBase):
         h = self.get_histogram(filename, histname)
         if rebin > 0:
             h.Rebin(rebin)
-        obs = w.var(obs_name)
+        obs = ws.var(obs_name)
         if not obs:
             raise RuntimeError("observable not initialized")
         h_data = ROOT.RooDataHist("hdata", "hdata", obs, h)