fix device bugs