Fix minor issues with file-write byte count calculation