changed to smater sync write