diff --git a/html/js/anc_script.js b/html/js/anc_script.js
index aa4edfaa2..84e90c947 100644
--- a/html/js/anc_script.js
+++ b/html/js/anc_script.js
@@ -81,9 +81,9 @@ function compute_total_table(p_table, seq)
var col = document.getElementsByName("val[" + seq + "][]");
for (i = 0; i < col.length; i++)
{
- // here is the problem
- tot += parseFloat(col[i].value);
-
+ if ( $(p_table).contains(col[i])) {
+ tot += parseFloat(col[i].value);
+ }
}
return tot;
}