Fix bugs in the calculation of the signal