fix some error management