bufio write bugfix + blockwise flushing