error handling for toc