Fixed a bug in the subtraction of the average signal.