fixed end of script totals