change write logic

writer will be shared