correctly working appending of files