It sounds like your anchor tags were not found in the HTML file (book.html#toc refers to an anchor tag named "toc").
Maybe because you did not put quotes around "toc"? It should be like <a name="toc">.
I've always used the Table of Contents Wizard in Mobipocket Creator, which creates the TOC based on expressions matching other HTML tags (like h1, h2, etc.) in the book.