Better error handling
Merge pull request #4 from tux-tn/patch-1

Better error handling