corrected regroup_blocks