Fix the hanging problem when the process pid is larger than numpids

Fixed a pagePtr typo. Modified the code so that when generating traces,
the process id can be larger than numpids (which is 1 in trace generation).
In this way, we can generate traces with different address space.