Fixes for running on 32-bit.

All tests pass.