more portability fixes, this time for OSX