Fix performance issue with 64-bit mode