Restore failure handler, improve latex output