Hey fandrieu,
I can't find where it's happening for the life of me, but something in your code is doubling the html output. It doesn't happen with books that have no ncx, but if it
does have ncx data, the html file being produced is the original html x 2: as in the whole book and then the whole book all over again.
Maybe you'll have better luck spotting it.