Fix for texlive.js to avoid stack errors in some cases