Fixes for the licensing system

New pull request, I made a little mistake in the first one.
These changes improve the licensing system and close the flaw I sent you yesterday.