fixed unsafe signal handler