fixes bugs in the cumulative calculation for xml output and catches null inserts for agg_timespent