Fix gain error identified by Taimi Mulder.