Rewrite mod handling