Correction of gain modulation