Good to hear. joinGroup() should really clear both session variables. I filed a bug report on this.
BTW, if you're sending group and/or role IDs rather than names, it's a good practice to do this:
$user->joinGroup( (int) $groupId, (int) $roleId);
The joinGroup() method uses is_string() to determine whether it's getting a name or an ID, so if it receives '1' it will try to add the user to a group named '1' rather than the group with the ID 1.
[ed. note: BobRay last edited this post 9 years, 4 months ago.]