fixed saving of groups to pg