Fix handling of group names with spaces