some fixes for 32bit build on 64bit