fix write context