Improved error reporting