adding try except block