fix write context error