fixed handling Ctrl-C