Fixed bugs in connection and cursor calls