Fix issue fwrite on PHP 5.4+