No memory why \begin{document} was being incorrectly patched

closes #161