Imrpoved handling of error messages