fix device iteration