some minor portability fixes