fix TypeError when toc_data is nil