implemented sync write option