32 bit and valgrind fix