testing on toc and some bug fixes resulting