Ctrl-C related bug fixes