Fix bug when selecting a new device