fixed bug in groupsOf()