slight fix for reentrancy of signal handler