Why did Madrid cede the territory to the US