fix a local unreferenced error and an import error on startup

Hi,

 just a couple of small fixes found during packaging