quick and dirty fix to make it compile and (seemingly) work
on 32 bits systems, it needs more testing though