more portability fixes