user relationship invite module doesn't automatically add inviter as relationship

I was using the user_relationship_invites module for creating user relationships among users when an invitation was sent . The invitation form contained a form for selecting a relationship with the invitee . But when the new user tried to register , the relationship with the inviter would vanish after the registration has been done . This issue has already been discussed at this place
http://drupal.org/node/175518. .
A patch had been implemented in the invite module, and so the module should be working properly , but it does not . the problem comes here

, in the file user_relationship_invites.module, the following code :

if (($code = arg(2)) && ($invite = user_relationship_invites_get_invite($code))) {
      $inviter           =& $invite->inviter;
      $relationship_type =& $invite->relationship_type;

in this part of the code $code = arg(2) does not hold true .arg(2) is the invite code sent to the new user in the invitation email . It is a session variable , and the above methode does not usually work : so i had to make the following changes :

if ($invite  = uri_load_from_session()) {
      $inviter           =& $invite->inviter;
      $relationship_type =& $invite->relationship_type;

and added the following function to user_relationship_invites.module :

function uri_load_from_session(){
          if (isset($_SESSION[INVITE_SESSION_NAME])) {
        return user_relationship_invites_get_invite($_SESSION[INVITE_SESSION_NAME]);
  }
  return FALSE;
}

the file user_relationship_invites.module with the above changes has been attached to this node and can be downloaded .

AttachmentSize
user_relationship_invites.module.zip1.57 KB