fixing get_permalink returning false in TOC generation