CONTRIB-5032: fixing problem with grouping creating an empty array of events