fix unused variable warning on non-linux systems
mop up more 32-bit checked int conversion bugs