fix 32 bit issues

this fixes all tests on my 32bit compilation except python binding tests. I have not looked into them. if anyone wants to, tell me and I provide error messages.