Fix bug in AD group extraction