Resolve issues with cursor ids crossing streams.
- Take the stream index the into account when checking for
  overrun buffers.
- Only process the next cursor if it's bigger than what we've
  already seen.
- Only update cursors relevant to the stream being processed.

#1973
Merge branch 'release' into dev