mistake due to using "a+" text writer