Fix exception on Ctrl-C