fix write context error in PHP5.4