fix exception handling
Merge pull request #11 from AliochaRyzhkov/fix-exception-handling

fix exception handling