fix error handling
Merge pull request #12 from Clever/fix-error-handling

fix error handling