Corrected error handling
Merge pull request #2 from mantiscy/master

Corrected error handling