Devices: fix wrongly placed assert and device count iteration