fix some issues with refreshing the token