Better error handling
Merge pull request #33 from phicoh/john-changes

Better error handling