Structural and ferroelectric transitions in magnetic nickelate PbNiO 3