Fixed bug when adding a device to a network