64-bit porting fixes