=Fix attributes parameter of bagify and aggregate, and fix recursion in aggregate