Merge changes I0c161fe7,Icfe1e64b

* changes:
  Fix a bug where 'avoid unvalidated' is broken
  Add a device config for actively preferring bad wifi