diff --git a/UNICADOworkflow/src/mission_study_loop/estimate_mission_study_residuals.py b/UNICADOworkflow/src/mission_study_loop/estimate_mission_study_residuals.py
index 1fb956ff2a242c2ab6ba781b0fb059f01cae25f2..e56c55460c90450c1f27598b0f826af092808f4e 100644
--- a/UNICADOworkflow/src/mission_study_loop/estimate_mission_study_residuals.py
+++ b/UNICADOworkflow/src/mission_study_loop/estimate_mission_study_residuals.py
@@ -94,10 +94,10 @@ def estimate_mission_study_residuals(paths_and_names, mission_study_variables, c
 
     # read iteration variables
     m_take_off_max_study = root_of_aircraft_exchange_tree.find("./analysis/mission/study_mission/takeoff_mass/value")
-    if m_take_off_max is not None:
-        m_take_off_max = float(m_take_off_max.text)
+    if m_take_off_max_study is not None:
+        m_take_off_max_study = float(m_take_off_max_study.text)
     else:
-        m_take_off_max = 0
+        m_take_off_max_study = 0
 
     fl_initial_cruise_study = root_of_aircraft_exchange_tree.find(
         "./analysis/mission/study_mission/cruise/cruise_steps@ID=0/altitude/value")