Fix issues when clearing token and fix warning.