Fix JS calc totals Closes #2525.