Make groupBy preserve keys when grouping objects.