[RDY] Broken build 32bit

There were a couple of issues preventing compile to succeed on 32 bit machines.

This includes a definitive fix for one of them and a temporary one for the other one.
Temporary fix is to maintain master buildable. I will contact original author for him to study/fix it further.