added try/except based on issue by bnevets27