Fix and improve SIGINT handler