Flare associated changes in the helicity of the solar magnetic fields