Improve type safety of bundled aggregations code.