In October 1818, Hagemeister appointed his second-in-command Navy Lt. Semyon Yanovsky, by then husband of Irina Baranov and thus Baranov's son-in-law, to act as Chief Manager and governor. Yanovsky was replaced in 1820 with Matvey Muravyev who had been appointed directly by the Board of the RAC. On 27 November, Baranov and Hagemeister left Alaska together on the Navy ship "Kutuzov" for Russia. The ship headed south on a route that would take it west around the Cape of Good Hope at the foot of the African continent, to sail northward to St. Petersburg. En route, the ship made an extended stopover in March 1819 in the Dutch settlement of Batavia, on the island of Java, then part of the colonial Dutch East Indies (present day Indonesia). Baranov became ill there, and soon after the ship resumed its journey, he died on 16 April 1819. He was buried at sea in the Sunda Strait off Panaitan, never reaching his homeland or his family.