64-bit portability fixes