cleanup the cursor creation