bugfix for token replacement