fix error handling in #2
Merge pull request #1 from longaccess/master

fix error handling in pull request #2