Fix some bugs for adding footnotes automatically.