fix entity grouping