Check group id before adding

Motivated by FlowForwarding/LINC-Switch#191.
Merge pull request #194 from legoscia/check_group_id

Check group id before adding