Improved error handling - and fix for that...