[FIX] Correct cursor management