fix the extra writting problem