Fix bug in creating group