misc. portability fixes