Hainan. She returned around 1295 with new strains of cotton, an early cotton gin, and other advances to cotton cultivation and processing that made the sandy lands of eastern Huating County so much more prosperous that Huang was later deified out of gratitude. By the mid-Qing, as much as ¾ of Songjiang's farmland was devoted to cotton. Under the Yuan, this new wealth saw Huating elevated to prefectural status and renamed Songjiangfu. This is sometimes considered the origin of China's modern textile industry. It was also under the Yuan that the city first had enough Hui to establish Shanghai's first mosque. In 1404, headwaters previously emptying into the Wusong were rerouted by local officials, diminishing the size of Suzhou Creek and expanding the Huangpu River to its modern importance. Songjiang was better fortified under the Ming in response to attacks by the Japanese "Wokou" pirates, who sometimes raided and sometimes occupied to the town. The Ming also saw the Jesuitswho counted the influential Shanghainese official Xu Guangqi among their convertsestablish the town's first known church. Owing to the importance of Portuguese and Latin at the time, the town's name was romanized Sumkiam. Following Dorgon's 21 July 1645 edict mandating the queue, the people of Songjiang rose up against the Qing to protect their hair, viewed as a symbol of virility and filial piety. Li Chengdong (, d. 1649) retook the city and massacred its population on 22 September 1645. Nonetheless, Songjiang remained the primary metropolis of the area of present-day Shanghai as late as the mid-19th century, when its name was typically romanized as Sungkiang. It continued to serve as the prefectural capital under the "Right" Governor of Jiangnan based in Suzhou and then later under the governor of Jiangsu at Jiangning (now Nanjing). Unlike the foreign-held area of Shanghai, however, it fell to rebels during the Taiping Rebellion's Eastern Expedition. About a hundred Europeans under Frederick Townsend Ward failed to retake the town in June 1860. After gathering more Westerners, over 80 Philippine "Manilamen", and several pieces of artillery, a second assault in July 1860 retook the town with heavy losses. Out of about 250 men, 62 were killed and about 100 wounded, including Ward. Songjiang was then used by Ward, Henry Andres Burgevine, their Ever-Victorious Army, and Cheng Xueqi's division of the Huai Army as a base for raids and attacks on other Taiping positions under Li Xiucheng