Fix erroneous toc links and heading links.