Disproportionation and comproportionation reactions of resistive switching in polycrystalline NiOx films