A method of operating an optical amplifier, said optical amplifier having a gain spectrum and comprising an optical amplifying medium, said gain spectrum being subject to variations as a result of changes in at least one operating condition of the amplifier, said method comprising inputting a plurality of signals at different wavelengths to the amplifier and adjusting the temperature of at least a portion of the optical amplifying medium based on the level of inversion of said portion to compensate for variations in the gain spectrum as a result of a change in said at least one operating condition, wherein the change in said at least one operating condition comprises a change in the wavelength of at least one of the signals.