Some improvements to ToTeX, plus improved checking of index entries