Tree rewrite fixes.