Fix 32-bit unsigned long issues