Fix 32-bit build problems

While building on my 32-bit Debian machine, I ran into some small build errors. The fixes below seem to work and make sense, though I only tested them lightly.