proper handle cursor handling