moved import into try except