replaced signal() with sigaction()