Improved global error handling
Merge branch 'dev'