better cursor handling