Moved debug to inside of try block