Fix edge case behavior of nextTokenOnChannel and previousTokenOnChannel

* Fixes #622
* Fixes #544