sort item groups correctly