Fix integer underflow in shared memory debugging