fix cursor wrap problem

fixes #6