Fix exiting prematurely
Merge pull request #8 from ypa/master

Fix exiting prematurely. Thanks @ypa!