Method of preventing corrosion