Fix exception on Ctrl-C
Merge pull request #1 from Shmuma/master

Fix exception on Ctrl-C