Minor agg fixes

some cleanup, some JSON encoding updates