Tweaking write method so null characters may be written