fixed memory leak in token