Fix grouping to toggle the elements when the level are more than 2.