- fixed detect group and group ungroup function