Compensation of self-phase modulation in a QND measurement of photon number based on the optical Kerr effect