Rewriter performance fix