fix cursor moving problem in issue #2 with workaround