General: Improved error handling

Fixes #17