Bug fixes brought by the rewrite.