Fix some issues with opt-in on rewrite.