Some portability fixes.