Fixed a bug in calculation fields that caused totals to be returned incorrectly.