Error handling improvements
Merge pull request #1 from soyoz/master

Error handling improvements