Ast rewriter performance fix