Fix 32-64bit issues