Improve error reporting