correct errors introduced when changing devices from array to object