Fix duplicate devices in groups #696