Improved error messages and logs