fix longterm memory training logic: only update the maximum activated memory at each position.