also make it more thread safe (avoid rare deadlock) and fix it trying to add devices before the CI has init