fixed bug and wrote test for cloning groups