fix bug when 'group' is used