Fixes chunks grouping

Fixes #3962