Add missing import and fix a `NameError`. Handle non existing keyfile, not even globbed.