Bug fix for searching in all groups
Restoring some code