fix writer race