Improved error reports and logging