added some try except loops