added error management