tried to fix problem with two write to file and removed synchronize