Add explicit error handling in more places
Merge pull request #367 from infosiftr/moar-error-handling

Add explicit error handling in more places