Fix scope of try/catch