Make token switching phonegap friendly