Fix error management/catching