Fixing the ugly signal handler