fixed the cursor getting lost