improved cursor-handling