Fixed compilation error around randsize call.
Fixed OS X problem in alternative writev implementation.