patch fixes error catching for attach