Fix a few bugs.
Fix chapter links when exporting XML.