Fix types and allow compiling on 32bits