But one of Joel's points is that, by the time you get around to rewriting something, you usually aren't dealing with the same programmers.
If this isn't the case, and you have the same core team available, then I agree, it is sometimes better to rewrite. But these days, refactoring techniques and testing methodologies are much more concretely defined and practice, so it still may be possible to essentially "rewrite" the code without having an X year shipping delay.