corrected appending to file