fixed wrong latex execution order