Fix race condition of signal processing