Several bugfixes related with device enumeration