Improved error handling again