Two years later he was sent with a small escort on a dangerous mission to the Central Asian states of Khiva and Bukhara. The khan of Khiva laid a plan for detaining him as a hostage, but he eluded the danger and returned safely, after concluding a treaty of friendship with the emir of Bukhara.