adding sorting of TOC when entries are sorted