Fixes a bug introduced in the performance enhancement code that caused a memory access violation. Accidentally used the wrong variable as the base of the offset. Also renamed an offset variable to properly reflect its origin.