Fix correctly get the cursor connection