Fix bug where toc would not remember if a section was expanded in some cases