NPE grouping on empty result