Port licensing fixes from 1.20

Licensing fixes

Various tweaks to address:

https://bugs.launchpad.net/bugs/1368321
https://bugs.launchpad.net/bugs/1368358