improve Ctrl-C handling (fix #10)