More defensive code in License Import Controller. fixes #697 closes #697. Not confident with this code - needs more refactoring