Fixing exception catching, including traceback.