handle null cursors better