improved error management