properly detect empty groups