clean up references to setTopTerm in pattern matching rewriter