changed handling of cursors a little