fixed token generation bug