Fix latex bugs