Toc accuracy fix

This fixes accuracy problems with the toc that occur upon page load. I'm not sure what I was thinking back when I wrote the last fix.