better error management on device creation