fixed unknown variable exception on group deletetion

also removed handling an unset group id, don't know when this could apply
fixed circular group relation checks

- prevent putting group into itself
- use recursion in circular relation check