file rewrite