improve signal management (come closer to real POSIX spec)