Fixed select_device method