[mr3040] Group: fix memleaks on empty groups after (mr2986) and (mr3037), also small rewriting.