Bugfix writing result in file(lost \n)