-BUGFIX: new token replacement logic for the connection