Protect against exceptions on grouping