fix bug when saving token