I can't see anything wrong with the code, especially comparing it with http://open.silverstripe.org/browser/modules/registration/trunk/code/RegisterPage.php, but in case anyone else can help, two questions come to mind:
* In terms of debugging: is the member being added to the database?
* Are you sure the group is being found at line 40? Try this:
Debug::show($group) just after it.