Fix iterator loop in findDevice()