added some try except statements