Added setCursorPos call to reset position of cursor