Fix errors that occur when streams don't match cursors
- Reset cursors when the number of streams and cursors
  don't match.
- Added unit tests

#2024