fix device flags bug