Corrected how attach_device is called