Bug fix with leaving groups