improved error handling (fixes #2, improves #6)
Merge pull request #11 from Jalle19/capture-errors-fixed

improved error handling (fixes #2, improves #6)