fixed rwbuf