portability fixes for 64-bit host