Trying to have a better error handling