Bugfix: do only group when grouping has indeed been defined.