Merge pull request #1 from longaccess/master

fix error handling in pull request #2
add more error handling, fix messages