Bugfix on mac in stdlib -- increasing offset and then writing instead of writing and then increasing offset