use append and fix rewrite file problem