rewrite file head