diff --git a/atdb/taskdatabase/services/algorithms.py b/atdb/taskdatabase/services/algorithms.py
index c692e2003c5065419cc2e1b5d71361cbacb542dc..074c146917f5644617e7b3032edc3e5c539bd2c5 100644
--- a/atdb/taskdatabase/services/algorithms.py
+++ b/atdb/taskdatabase/services/algorithms.py
@@ -741,6 +741,8 @@ def construct_summary(task):
     title = ""
     totals = ""
     results = ""
+    total_size_input = 0
+    total_size_output = 0
 
     sas_id = task.sas_id
     title = "<h4>Summary File for SAS_ID " + task.sas_id + "</h4> "
@@ -753,9 +755,6 @@ def construct_summary(task):
         try:
             summary = task.quality_json["summary"]
 
-            total_size_input = 0
-            total_size_output = 0
-
             for key in summary:
                 record = summary[key]