Improved error management