problem with fwrite

guys this one is the same problem with net/socket (Version 1), the !$written sometimes is 'converted' to false, instead of !$written, check if it's === false