Fix bugs in Group Function