'Protect' from names in a global scope, fix type errors, fix warnings.