prevent appending 'undefined' to unique tokens