Fix bugs with new groups code