fixed a bug with data grouping