Fixed wrong use of cursor.